How to capture PCM data from Wave Out

How could I record audio programmatically? I am implementing an application that transfers real-time desktop to the network. Video completed. I need to implement the audio part. I need a way to get PCM data from a sound card to feed to my encoder (implemented using the Windows Media format).

I think the answer is related to the openMixer (), waveInOpen () functions in the Win32 API, but I don’t know exactly what to do.

How to open the necessary channel and how to read PCM data from it?

Thanks in advance.

+4
source share
2 answers

I do not think that there is a direct way to do this using the OS - this is a function that may (or may not) be present on the sound card. Some sound cards have a loopback interface - Creative calls it “What U Hear”. You simply select this as an input, not a microphone, and record it using the usual waveInOpen (), which you already know about.

If the sound card does not have this feature, I think you're out of luck, except to do something crazy, how to make your own driver. Or you can convince your users to use the cable from the speaker output to the line input :)

+4
source

The new Windows Vista Core Audio APIs support this feature explicitly (called Loopback Recording), so if you can live with a Vista-only application, this is the way to go.

See instructions

+7
source

Source: https://habr.com/ru/post/1276993/


All Articles