在Vista中以编程方式设置默认声音设备 [英] Setting Default Sound Device programmatically in Vista
问题描述
在我的应用程序中,我需要以编程方式设置默认声音
设备(播放设备),在XP上可以更改
HKEY_CURRENT_USER \ Software \ Microsoft \ Multimedia \ Sound Mapper \ Playback
值,但在Vista上则无法使用.
使用新的Core Audio API,无法更改默认值
声音设备,只能通过以下方式使用GetDefaultAudioEndpoint()方法获取它:
IMMDeviceEnumerator接口.
我试图弄清楚注册表中更改了哪些键/值
当我手动更改默认设备时.其实有3个二进制
值更改为角色:0",角色:1";和角色:2";在下面
以下键:
"HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ MMDevices \ Audio \ Render \ {GUID}".
我猜这三个价值源于此声音设备的作用:控制台,多媒体和通讯.
现在这些值是二进制值,我无法弄清楚它们是如何
进行了更改,只是对于默认设备,它们必须更大.
也许有人可以帮助我弄清楚这些价值如何
计算或更改Vista上默认设备的其他解决方案?
最好的问候,
Boby
Hi,
In my application I need to set programmatically the default sound
device (playback device), on XP there is a way changing the
HKEY_CURRENT_USER\Software\Microsoft\Multimedia\Sound Mapper\Playback
value, but on Vista this isn't working.
Using the new Core Audio API there is no way to change the default
sound device, only to get it with GetDefaultAudioEndpoint() method from
IMMDeviceEnumerator interface.
I tried to fiigure out which keys/values are changed in the registry
when I manually change the default device. Actually there are 3 binary
values changed "Role:0", "Role:1" and "Role:2" under the
following key:
"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\MMDevices\Audio\Render\{GUID}".
I guess these three valuse are comming from the role of this sound device: console, multimedia and communcations.
Now these values are binary values and I cannot figure out how they are
changed, only that they must be greater for the default device.
Maybe someone could help me to figure out how these values are
calculated or another solution to change the default device on Vista ?
Best regards,
Boby
推荐答案
Boby,
我也想要与您在查询中解释的内容相同的内容.如果您有解决方案,请重播.
I want also same thing as you have explained in your query. If you have some solution then please replay me.
这篇关于在Vista中以编程方式设置默认声音设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!