Recording with NAudio using C#

前端 未结 2 1565
刺人心
刺人心 2021-02-06 13:42

I am trying to record audio in C# using NAudio. After looking at the NAudio Chat Demo, I used some code from there to record.

Here is the code:

using Sys         


        
2条回答
  •  南笙
    南笙 (楼主)
    2021-02-06 14:05

    Just use WaveInEvent instead of WaveIn and the code will work. Then the handling happens on a separate thread instead of in a window message loop, which isn't available in a console application.

    Further reading:
    https://github.com/naudio/NAudio/wiki/Understanding-Output-Devices#waveout-and-waveoutevent

    (The feature was added in 2012, so at the time of the question it wasn't available)

提交回复
热议问题