public AudioBuffer[] Unqueue(int count) { AudioBuffer[] result = new AudioBuffer[count]; int[] ids = new int[count]; using (Context.Bind()) AL.SourceUnqueueBuffers(Id, count, ids); for (int index = 0; index < count; index++) { var buffer = buffers[0]; buffers.RemoveAt(0); result[index] = Context.GetBuffer(ids[index]); if (buffer.Id != ids[index]) { throw new InvalidProgramException(); } } return(result); }
void FillBuffer(AudioBuffer buffer) { int read = stream.Read(bufferSamples, 0, bufferSamples.Length); buffer.Data(stream.Format, bufferSamples, 0, read / stream.Format.SampleByteSize(), stream.Frequency); }