/// <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); }
/// <summary> /// Plays the sample directly. /// Panning may be controlled through the provided /// AGATPanInfo instance. /// 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, AGATPanInfo panInfo, 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, panInfo, mixCallback, gain); lock ( _scheduledSamples ) { _scheduledSamples.Enqueue(newSample); } return(newSample); }