Working with the Win32 API here. I've been scouring through the MSDN documentation for the core audio services in Windows Vista+, and haven't had much luck finding a way to secure the default audio buffer.
My goal is to set up a real-time spectrograph data of the audio being played. Is there any way to ac开发者_JS百科cess the audio stream before it is played through the speakers?
EDIT: I think I found the answer. Posted below.
Good News lads! I figured out a solution.
The WASAPI Loopback Recording mode, outlined here: http://msdn.microsoft.com/en-us/library/windows/desktop/dd316551(v=vs.85).aspx, lists in detail a way to "copy the output stream from the audio engine into an application's capture buffer". Its as close to a pointer of the audio output buffer as possible.
Therefore, technically it isn't possible to actually access the audio engine's buffer (in software at least), but you can read what's the Wave Out mix is.
Once I get this working, I'll post about any latency issues.
精彩评论