简体   繁体   English

Windows 音频驱动程序与 WASAPI

[英]Windows Audio Driver vs. WASAPI

I'm right now reading the microsoft documentation about drivers and core audio apis.我现在正在阅读有关驱动程序和核心音频 api 的微软文档。 At the moment I'm still confuse which way to go to achieve what I need.目前我仍然困惑要走哪条路才能实现我的需要。 I have an audio application which is Standalone and coded with framework JUCE in C++.我有一个独立的音频应用程序,并使用 C++ 框架 JUCE 进行编码。 And I need to build a Windows solution that would capture the audio stream that is going to an audio endpoint device to use it as an input of my audio application.而且我需要构建一个 Windows 解决方案,该解决方案可以捕获将要发送到音频端点设备的音频流,以将其用作我的音频应用程序的输入。

  • This stream must have an unaltered volume: always 1.0 (no matter if the hardware volume is changed or muted).此流必须具有未更改的音量:始终为 1.0(无论硬件音量是否更改或静音)。
  • I must be able to choose between the different endpoint devices, for exemple if I have an external soundcard that is plugged, my audio application should be able to intercept and copy the stream that is going to that external soundcard, or do the same for the stream that is going to the built-in speakers.我必须能够在不同的端点设备之间进行选择,例如,如果我插入了一个外部声卡,我的音频应用程序应该能够拦截和复制流向该外部声卡的流,或者对外部声卡执行相同的操作流到内置扬声器。
  • The idea is to capture the output streams before they are modified by hardware volume modifications, and make a copy of them routed to my application without changing the output routing and behaviour.这个想法是在输出流被硬件卷修改修改之前捕获它们,并将它们的副本路由到我的应用程序而不改变输出路由和行为。

The microsoft documentation is very furnished, but even if the WASAPI provides a lot of ways to capture and stream from audio endpoint devices, I'm not sure it is possible to get an unaltered volume, as it will always capture what's exactly coming out of the speakers.微软的文档非常齐全,但即使 WASAPI 提供了很多从音频端点设备捕获和流式传输的方法,我也不确定是否有可能获得一个不变的音量,因为它总是会捕获究竟是什么从扬声器。 This is why I don't know If I can implement a feature directly in my audio application that will get the streams I want with WASAPIs or if I have to code a proper Audio Driver that would make a copy of the streams I want for my application to be able to use these streams.这就是为什么我不知道我是否可以直接在我的音频应用程序中实现一个功能来获得我想要的 WASAPI 流,或者我是否必须编写一个合适的音频驱动程序来复制我想要的流应用程序能够使用这些流。

The documentations I refer to: Audio Drivers design guide Core Audio APIs / WASAPI我参考的文档: Audio Drivers design guide Core Audio APIs / WASAPI

Thanks for the help,谢谢您的帮助,

Best,最好的事物,

Maxime马克西姆

Sometimes the volume control is implemented in software, and sometimes it is implemented in hardware.音量控制有时用软件实现,有时用硬件实现。 You can call IAudioEndpointVolume::QueryHardwareSupport to see if the volume control for the audio endpoint you're working with is implemented in hardware or software.您可以调用IAudioEndpointVolume::QueryHardwareSupport来查看您正在使用的音频端点的音量控制是在硬件还是软件中实现的。

Sometimes the audio loopback is implemented in software, and sometimes it is implemented in hardware.音频环回有时用软件实现,有时用硬件实现。 There is no API to tell which.没有 API 可以说明是哪个。

If the audio loopback is implemented in software, and the volume control is implemented in hardware, then you will get back the data you want.如果音频环回在软件中实现,音量控制在硬件中实现,那么你就会得到你想要的数据。

If the audio loopback is implemented in hardware, or the volume control is implemented in software, the the audio data you get back has already had the volume adjustment applied.如果音频环回是在硬件中实现的,或者音量控制是在软件中实现的,那么你得到的音频数据已经应用了音量调节。

What does your application do with the audio data it receives?您的应用程序如何处理它接收到的音频数据? The primary use case for audio loopback data is echo cancelation, where you usually WANT the volume to be applied.音频环回数据的主要用例是回声消除,您通常希望在其中应用音量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM