private void RaiseDataAvailable(WaveInBuffer buffer) { var handler = DataAvailable; if (handler != null) { handler(this, new WaveInEventArgs(buffer.Data, buffer.BytesRecorded)); } }
private void CreateBuffers() { // Default to three buffers of 100ms each int bufferSize = BufferMilliseconds * WaveFormat.AverageBytesPerSecond / 1000; if (bufferSize % WaveFormat.BlockAlign != 0) { bufferSize -= bufferSize % WaveFormat.BlockAlign; } buffers = new WaveInBuffer[NumberOfBuffers]; for (int n = 0; n < buffers.Length; n++) { buffers[n] = new WaveInBuffer(waveInHandle, bufferSize); } }