Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. private WasapiCapture capture;
  2. private WaveWriter writer;
  3.  
  4. private void startRecording()
  5. {
  6. capture = new WasapiCapture();
  7. capture.Initialize();
  8. writer = new WaveWriter("file.wav", capture.WaveFormat);
  9. capture.DataAvailable += (s, capData) =>
  10. {
  11. writer.Write(capData.Data, capData.Offset, capData.ByteCount);
  12. };
  13. capture.Start();
  14. }
  15.  
  16. private void stopRecording()
  17. {
  18. if (writer != null && capture != null)
  19. {
  20. capture.Stop();
  21. writer.Dispose();
  22. capture.Dispose();
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement