コード例 #1
0
ファイル: GATPlayer.cs プロジェクト: uniphonic/G-Audio
 public void Init(GATData isample, GATTrack track, OnShouldMixSample callback, float gain = 1f)
 {
     AudioData          = isample;
     _track             = track;
     _onShouldMixSample = callback;
     _gain        = gain;
     IsFirstChunk = true;
     _count       = isample.Count;
     _fadeStart   = -1;
 }
コード例 #2
0
ファイル: GATPlayer.cs プロジェクト: uniphonic/G-Audio
 public void Init(GATData isample, AGATPanInfo panInfo, OnShouldMixSample callback, float gain = 1f)
 {
     AudioData          = isample;
     PanInfo            = panInfo;
     _onShouldMixSample = callback;
     _gain        = gain;
     IsFirstChunk = true;
     _count       = isample.Count;
     _fadeStart   = -1;
 }
コード例 #3
0
ファイル: GATPlayer.cs プロジェクト: uniphonic/G-Audio
            public void Clear()
            {
                AudioData.Release();

                _onShouldMixSample = null;
                IsLastChunk        = false;

                next      = null;
                AudioData = null;

                shouldBeRemoved = false;

                PanInfo   = null;
                NextIndex = 0;

                _track = null;
            }
コード例 #4
0
ファイル: GATPlayer.cs プロジェクト: uniphonic/G-Audio
        /// <summary>
        /// Plays the sample through the specified track,
        /// at sample accurate dspTime. Note that dspTime must be greater or equal
        /// to AudioSettings.dspTime + GATInfo.AudioBufferDuration, or the sample will not be
        /// added to the playing queue.
        /// </summary>
        public IGATBufferedSampleOptions PlayDataScheduled(GATData sample, double dspTime, int trackNb, float gain = 1f, OnShouldMixSample mixCallback = null)
        {
            if (dspTime < AudioSettings.dspTime + GATInfo.AudioBufferDuration)             // Next buffer dspTime
            {
                                #if GAT_DEBUG
                Debug.LogWarning("cannot play at such short notice.");
                                #endif
                return(BufferedSample.VoidOptions);
            }

            sample.Retain();
            BufferedSample newSample = GetBufferedSample();
            newSample.scheduledDspTime = dspTime;

            newSample.Init(sample, _tracks[trackNb], mixCallback, gain);

            lock ( _scheduledSamples )
            {
                _scheduledSamples.Enqueue(newSample);
            }

            return(newSample);
        }
コード例 #5
0
ファイル: GATPlayer.cs プロジェクト: uniphonic/G-Audio
        /// <summary>
        /// Plays the sample directly.
        /// Panning may be controlled through the provided
        /// AGATPanInfo instance.
        /// </summary>
        public IGATBufferedSampleOptions PlayData(GATData sample, AGATPanInfo panInfo, float gain = 1f, OnShouldMixSample mixCallback = null)
        {
            sample.Retain();
            BufferedSample newSample = GetBufferedSample();

            newSample.Init(sample, panInfo, mixCallback, gain);

            lock ( _samplesToEnqueue )
            {
                _samplesToEnqueue.Enqueue(newSample);
            }

            return(newSample);
        }