通过代码激活声音设备? [英] Activate sound devices via code?

查看:125
本文介绍了通过代码激活声音设备?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我在
上发布了此内容 MSDN论坛»音频和视频开发»媒体基金会开发
在找到此论坛之前.我认为这是一个更好的地方.由于某些原因,我无法在此处删除它,因此请不要怪我重复发布:)

在Vista声音控制中-panel可以激活和停用现在称为声音的设备(麦克风,线路输入,电话等).
是否有通过代码执行此操作的方法?

首先,我没有使用
EnumAudioEndpoints方法使用预定义的标志来管理它以获取停用的设备.
在我的系统上,如果
设备未激活,注册表中的设备状态为0x10000001.
我用此值定义了一个自定义标志,EnumAudioEndpoints
方法成功返回了停用的设备.

有没有激活此设备的方法?我试图通过代码编辑注册表
条目,但是得到了UnauthorizedAccess Exeptions.使用regedit
可以工作.
设备对象提供了GetState,但不幸的是没有提供SetState
方法.

任何提示都将非常有帮助!

Hello!

I posted this on 
MSDN Forums » Audio and Video Development » Media Foundation Development
before I found this forum. I think this is a better place. For some reasons I could not delete it there, so please don´t blame me for double-posting :)

In the Vista sound-control-panel one can activate and deactivate what is now
called sound devices (microphon, line-in, phone etc.)
Is there a was to do this via code?

First of all I did not manage it to get the deactivated devices by the
EnumAudioEndpoints Method using the predefined flags.
On my system the device state in the registry is 0x10000001, in case of a
device not beeing active.
I defined a custom flag with this value and the EnumAudioEndpoints
method succesfully returned the deactivated devices.

Is there a way to activate this devices? I tried to edit the registry
entries via code, but got UnauthorizedAccess Exeptions. Using regedit
works.
The device object provides a GetState but unfortunately not a SetState
method.

Any hints would be very helpfull!

推荐答案

很抱歉,没有用于更改音频终结点设备状态的公共API.这是设计使然.

此致

Mitch Rundle

Microsoft

此帖子提供为"AS IS"没有任何保证,也不授予任何权利.


这篇关于通过代码激活声音设备?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆