如何将麦克风静音 C#
我想知道,如果我想切换麦克风静音/取消静音,编码是什么。我正在制作一个可以在后台运行并拾取按键事件并切换麦克风静音/取消静音的程序。任何有关该编码的帮助都会非常有帮助。我对 C# 还很陌生,这只是我想要制作的一个非常简单的程序。这就是它所做的全部,它会监听空格键的按键,即使程序位于后台,然后当按下空格键时,它会将麦克风静音/取消静音。
感谢您提供的所有帮助!
I wanted to know, what would the coding be if I wanted to toggle mute/unmute of my microphone. I am making a program that can run in the background and pickup a keypress event and toggle mute/unmute of the mic. Any help with any of that coding would be very helpful. I am pretty new to C#, and this is just a really simple program I wanted to make. That is all it does, is it will listen for keypress of the spacebar, even when the program is in the background, then when the spacebar is pressed it will mute/unmute the mic.
Thank you for any and all help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
对于 Windows Vista 及更高版本,您不能再使用媒体控制界面,Microsoft 有一个新的
Ray Molenkamp 在这里编写了一个很好的托管包装器,用于与 Core Audio API 交互:
Vista Core Audio API 主音量控制
因为我需要能够将麦克风静音XP、Vista 和 Windows 7 我写了一些 Windows 麦克风静音库 在较新的操作系统上使用 Ray 的库以及 Gustavo Franco 的 MixerNative 库 适用于 Windows XP 及更早版本。
For Windows Vista and newer, you can no longer use the Media Control Interface, Microsoft has a new Core Audio API that you must access to interface with audio hardware in these newer operating systems.
Ray Molenkamp wrote a nice managed wrapper for interfacing with the Core Audio API here:
Vista Core Audio API Master Volume Control
Since I needed to be able to mute the microphone from XP, Vista and Windows 7 I wrote a little Windows Microphone Mute Library which uses Ray's library on the newer operating systems and parts of Gustavo Franco's MixerNative library for Windows XP and older.
您可以下载整个应用程序的源代码,该应用程序具有使麦克风静音、选择其作为录音设备等功能。
http://www.codeguru.com/csharp/csharp/cs_graphics/sound/article.php/c10931/
You can download the source of a whole application which has muting the microphone, selecting it as a recording device, etc.
http://www.codeguru.com/csharp/csharp/cs_graphics/sound/article.php/c10931/
您可以使用 MCI(媒体控制接口)访问麦克风并明智地更改其音量系统。检查下面的代码,应该将所有系统麦克风的音量设置为 0。代码在c中;检查 pinvoke 了解如何将此代码转换为 c#
这里可以找到有关此主题的更多代码
希望这有帮助,问候
you can use MCI (Media Control Interface) to access mics and change their volume system wise. Check the code below it should be setting volume to 0 for all system microphones. Code is in c; check pinvoke for details on how to translate this code to c#
here you can find more code on this topic
hope this helps, regards
我在 win7 中有多个麦克风,并且类 WindowsMicrophoneMuteLibrary.CoreAudioMicMute 在这种情况下不正确。
所以我更改了代码并且效果很好,因为现在他的杯子吹口哨了所有麦克风,而不仅仅是win7最后识别的。
我正在附加新课程以使其到位。
http://www.developpez.net/论坛/d1145354/dotnet/langages/csharp/couper-micro-sous-win7/
I have several microphones in win7 and class WindowsMicrophoneMuteLibrary.CoreAudioMicMute is incorrect in this case.
so I change the code and works great because now his cup Whistle all microphones and not just in the last recognized by win7.
I am attaching the new class to put in place.
http://www.developpez.net/forums/d1145354/dotnet/langages/csharp/couper-micro-sous-win7/