コード例 #1
0
            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();
            }
コード例 #2
0
            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();
            }