在 Windows 7 上捕获单个应用程序的音频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6084550/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Capture audio of a single application on Windows 7
提问by Isaac Waller
Is there a way to capture the audio outputted by only a single application, and not the system as a whole? With WASAPII can capture the entire system audio, but I wish to only capture the audio from one application (there will be many applications, all playing audio at once.)
有没有办法只捕获单个应用程序输出的音频,而不是整个系统?使用WASAPI我可以捕获整个系统音频,但我希望只从一个应用程序中捕获音频(会有很多应用程序,同时播放音频。)
采纳答案by lethe
Detoursis used for hooking. Using the lib to hook IAudioRenderClientinterface, including GetBufferand ReleaseBuffer, and read data from the buffer.
Detours用于挂钩。使用 lib 钩住IAudioRenderClient接口,包括GetBuffer和ReleaseBuffer,并从缓冲区读取数据。
回答by Femi
Depending on the APIs used by the application to play the audio, you could write an AppInit DLL that will wrap the built-in waveIn\waveOut functions and would pass along the audio data. I know this works with the waveIn\waveOut functions, but not sure what other audio playback interfaces there are on Windows 7 and whether they are compatible with the AppInit trick.
根据应用程序用于播放音频的 API,您可以编写一个 AppInit DLL,该 DLL 将包装内置的 waveIn\waveOut 函数并传递音频数据。我知道这适用于 waveIn\waveOut 函数,但不确定 Windows 7 上还有哪些其他音频播放接口以及它们是否与 AppInit 技巧兼容。