public override int RecordRead(byte[] buffer, int length) { OpenALSoundWorld.criticalSection.Enter(); int samplesAvailable; Alc.alcGetIntegerv(alCaptureDevice, Alc.ALC_CAPTURE_SAMPLES, 1, out samplesAvailable); int bytesAvailable = channels * 2 * samplesAvailable; int needLength = Math.Min(length, bytesAvailable); unsafe { fixed(byte *pBuffer = buffer) Alc.alcCaptureSamples(alCaptureDevice, (IntPtr)pBuffer, needLength / (channels * 2)); } OpenALSoundWorld.criticalSection.Leave(); return(needLength); }