C#编程中的Jack Sensing [英] Jack Sensing in C# programming
本文介绍了C#编程中的Jack Sensing的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何在C#中控制音频的插孔感应
我想获取有关以下内容的杰克信息:
设备处于活动状态!
设备已禁用!
设备不存在!
或
I want to know how I can Control jack sensing in C# for audio
I wanna getting jack information about:
Device is active!
Device is disabled!
Device is not present!
or
Device is unplugged!
推荐答案
好吧,这取决于插孔的敏感程度.说真的,你到底在说什么?要控制外部实际设备,您需要一个界面.然后,您对该接口进行编码.您不能只要求神奇地控制硬件的C#代码.
您是指USB设备吗?您可以判断它是否存在,但是不存在和拔出插头有何不同?
^ ]是程序员的方式处理这样的问题.
Well, that depends on how sensitive jack is. Seriously, what the hell are you talking about ? To control an external real world device, you need an interface. Then you code to that interface. you can''t just ask for C# code that magically controls a piece of hardware.
Do you mean a USB device ? You can tell if it''s present or not, but how is not present and unplugged different ?
This[^] is how programmers deal with issues like this.
我找到了.
使用 CoreAudioApi 并从 MMDeviceEnumerator 类创建对象.我们可以使用 MMDeviceEnumerator 方法检查音频端口状态.
I found it.
Use CoreAudioApi and create object from MMDeviceEnumerator class. We can use MMDeviceEnumerator methods for checking audio port status.
这篇关于C#编程中的Jack Sensing的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文