private void Start() { loopbackCapture.DataAvailable += delegate(object sender, WaveInEventArgs e) { if (e.BytesRecorded % 2 != 0) { throw new Exception("illegal state"); } AudioUtil.L16leToL16be(e.Buffer, 0, e.BytesRecorded); // DLNA LPCM must be big-endian (WAV is little-endian) foreach (CircleBuffer cb in loopbackBuffers) { lock (lockObject) { cb.Write(e.Buffer, 0, e.BytesRecorded); } } }; loopbackCapture.StartRecording(); }
private void Start() { loopbackCapture.DataAvailable += delegate(object sender, WaveInEventArgs e) { if (e.BytesRecorded % 2 != 0) { throw new Exception("illegal state"); } CircleBuffer[] circleBuffersLocalCopy = loopbackBuffers.ToArray(); // avoids InvalidOperationException foreach (CircleBuffer cb in circleBuffersLocalCopy) { lock (lockObject) { cb.Write(e.Buffer, 0, e.BytesRecorded); } } }; loopbackCapture.StartRecording(); }