简体   繁体   English

如何将音频 output 路由到 Windows 中选定的音频端点/设备?

[英]How do I route audio output to a selected audio endpoint/device in Windows?

TL;DR: When playing audio using Windows UWP MediaPlayer, how do I route audio to a specific audio device/endpoint? TL;DR:使用 Windows UWP MediaPlayer 播放音频时,如何将音频路由到特定的音频设备/端点?

Full Context全文

I'm working on an app to place calls.我正在开发一个应用程序来拨打电话。 Some requirements are:一些要求是:

  • Play audio sounds at different points (eg when the call hangs up)在不同点播放音频声音(例如,挂断电话时)
  • Allow users to change in-call audio output to different endpoints (not an issue)允许用户将通话中的音频 output 更改为不同的端点(不是问题)
  • Ensure that when in-call audio has routed to a different "default" endpoint, that any other sounds that are played are routed to the same endpoint ( this is what I need help with )确保当通话中的音频路由到不同的“默认”端点时,播放的任何其他声音都路由到同一端点(这是我需要帮助的

Currently, when I route audio to a different endpoint, other sounds that are played with Windows UWP MediaPlayer do not get routed to the same "new" endpoint.目前,当我将音频路由到不同的端点时,使用 Windows UWP MediaPlayer 播放的其他声音不会路由到相同的“新”端点。 This makes sense since we aren't changing application-wide settings.这是有道理的,因为我们没有更改应用程序范围的设置。

My question is: How do I route audio to the same endpoint that the call audio is going through, given that I'm using Windows UWP MediaPlayer and given that I can get device information?我的问题是:假设我正在使用 Windows UWP MediaPlayer 并且我可以获得设备信息,我如何将音频路由到呼叫音频所经过的同一端点?

When playing audio using Windows UWP MediaPlayer, how do I route audio to a specific audio device/endpoint?使用 Windows UWP MediaPlayer 播放音频时,如何将音频路由到特定的音频设备/端点?

Please check Output to a specific audio endpoint document.请查看Output 到特定的音频端点文档。 By default, the audio output from a MediaPlayer is routed to the default audio endpoint for the system, but you can specify a specific audio endpoint that the MediaPlayer should use for output. You could use GetAudioRenderSelector to get the render selector then use FindAllAsync to get render device the pass the specific device to mediaplayer AudioDevice property.默认情况下,来自 MediaPlayer 的音频 output 被路由到系统的默认音频端点,但您可以指定 MediaPlayer 应该用于 output 的特定音频端点。您可以使用GetAudioRenderSelector获取渲染选择器,然后使用FindAllAsync获取渲染设备将特定设备传递给 mediaplayer AudioDevice属性。

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

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