音频插孔检测 [英] Audio Jack detection

查看:76
本文介绍了音频插孔检测的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我正在开发一个带语音命令的应用程序,我正在寻找一种方法来检测什么东西插入计算机上的一个音频插孔。无论是否是耳机或麦克风插孔。我只需知道 SOMETHING 什么时候插入或拔掉插头。我搜索了各种各样的论坛,每个人总是回答Mics不是数字的,他们无法被发现。我知道。就像我说的那样,我只需要知道如何分辨什么东西,无论它是什么,插入或从任何音频插孔中移除。我希望我我已经清楚我需要做什么了。

解决方案

你在网上找到的是对的,你无法检测到它。



音频插孔是简单的连接器,可以发送模拟信号,也可以接收模拟信号。如果有东西连接到它们,它们的功能相同。他们没有检测硬件是否安装的方法。



通过软件检测麦克风并不是太糟糕,只需要监听端口如果根本没有信号(没有噪音)那么你可以假设没有任何连接。扬声器插孔是不同的,因为你可以发出你想要的声音,如果没有连接扬声器就听不到它。



有只是无法检测扬声器是否存在



如果有一种通过扬声器插孔测量连续性的方法会有所不同,但那里不是

好。似乎我只需要在try / catch块中为语音识别器设置SetInputToDefaultAudioDevice。感谢Ron Beyer的回复。


有一种方法可以检测到它。



看看这里http://stackoverflow.com/questions/33872895/detect- if-headphones-in-or-or-not-via-c-sharp [ ^ ]





但问题是如何区分音频设备与集成AUdio设备= Speackers。



要解决它,我们必须获取杰克信息。好吧......我不知道得到这个信息。


Hi everyone, I'm developing a application with voice commands and I'm looking for a way to detect when something is plugged into one of the audio jacks on a computer. It doesn't matter whether it's the headphone or microphone jack. I just need to know when SOMETHING gets plugged in or unplugged. I've searched all kinds of forums and everyone always answers that Mics aren't digital and they can't be detected. I know that. Like I said, I just need to know how to tell when something, it doesn't matter what it is, is plugged in or removed from any of the audio jacks. I hope I've been clear on what I need to do.

解决方案

What you've found online is right, you can't detect it.

The audio jacks are simple connectors that either send analog signals out, or receive them in. They function the same if something is connected to them as when something isn't. They don't have a method for detecting if the hardware is attached or not.

A microphone isn't too bad to detect through software, just listen on the port and if there is no signal at all (no noise) then you can assume that there is nothing connected. The speaker jack is different, since you can send sound out all you want and it just won't be heard if there is no speakers attached.

There's just no way to detect if speakers are there or not

It would be different if there were a method for measuring continuity through the speaker jack, but there isn't.


okay. it seems that I'm just going to have to put the SetInputToDefaultAudioDevice for the speech recognizer in a try/catch block. Thanks for your reply Ron Beyer.


There is a way to detect it.

Take a look here http://stackoverflow.com/questions/33872895/detect-if-headphones-are-plugged-in-or-not-via-c-sharp[^]


But the problem is how to difference Audio Device from the Integrated AUdio Device = Speackers.

And to resolve it we have to obtain the Jack Information. Well... I don kno whot to get this info.


这篇关于音频插孔检测的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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