protected short[] AudioBufferFillCallback() { SamplePair pair; if (sampleQueue.TryDequeue(out pair)) { if (oscilloscope != null) { oscilloscope.AddSamples(pair.samples); } // Tell player thread it needs to generate one more frame. bufferSemaphore.Release(); // Mix in metronome if needed. if (pair.metronomePosition >= 0) { pair.samples = MixSamples(pair.samples, metronomeSound, pair.metronomePosition, pair.metronomePitch, pair.metronomeVolume); } return(pair.samples); } else { // Trace.WriteLine("Audio is starving!"); return(null); } }
protected short[] AudioBufferFillCallback() { short[] samples = null; if (sampleQueue.TryDequeue(out samples)) { if (oscilloscope != null) { oscilloscope.AddSamples(samples); } // Tell player thread it needs to generate one more frame. bufferSemaphore.Release(); } //else //{ // Trace.WriteLine("Audio is starving!"); //} return(samples); }