Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private WasapiCapture capture;
- private WaveWriter writer;
- private void startRecording()
- {
- capture = new WasapiCapture();
- capture.Initialize();
- writer = new WaveWriter("file.wav", capture.WaveFormat);
- capture.DataAvailable += (s, capData) =>
- {
- writer.Write(capData.Data, capData.Offset, capData.ByteCount);
- };
- capture.Start();
- }
- private void stopRecording()
- {
- if (writer != null && capture != null)
- {
- capture.Stop();
- writer.Dispose();
- capture.Dispose();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement