I want to capture audio from speaker using Waveform Audio API
.
I have searched and found posts that explain how to use Waveform Audio to capture audio from microphone and save to file or playback. However, none explain how to capture audio from speaker.
My understanding is that if i provide handle to a playback device in waveInOpen()
then i can capture sound from speaker. This is where i need help. How to get handle of a playback device? When I provide WAVE_MAPPER (or 0) for uDeviceID
, it always records from mic. If I set any other value, I always get out of range error.
EDIT:
I have done some more research since i posted question. I have found other options/APIs that i can use for audio capture. I need help to point me in the right direction which one to use for capturing audio from speaker. I dont want anything fancy which involves lot of code. My target OS is XP and above.
waveInOpen & Mixer:
Comments/Discussion on these links hint that waveInOpen()
can be used to grab audio from speaker. According to these, one has to open Mixer. I have used mixerOpen()
to get mixer handle but dont know how to use this handle with waveInOpen()
.
How do I capture the audio that is being played?
Sound from mic vs sound from speaker
XAudio2:
Can i use XAudio2 to capture audio from speaker? If yes then please do share some sample code.