在Ubuntu中使用C/C ++进行线入插孔感应 [英] Line-in jack sense with C/C++ in Ubuntu

查看:94
本文介绍了在Ubuntu中使用C/C ++进行线入插孔感应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是在这里被要求死刑的,但我永远无法找到最终解决方案(可能是出于充分的理由).

This has probably been asked to death around here, but I could never get to a final solution (probably for good cause).

无论如何,Ubuntu中有什么方法(我将Ubuntu 11.04与2.6.38-8内核一起使用)来检测是否插入了耳机?具体来说,我正在寻找C/C ++解决方案以轮询我的ALSA设备,以检测是否已插入耳机设备.

Anyway, is there any way in Ubuntu (I use Ubuntu 11.04 with kernel 2.6.38-8) to detect if there is a headphone plugged in? Specifically, I'm searching for C/C++ solutions to poll my ALSA device to detect if a headphone device has been plugged in.

在我搜索的所有线程中,此链接仅处理使用Windows,我无法确定这链接提供了一个适当的解决方案(无论是否插入耳机,都没有改变.)

Of all the threads I searched, this link deals only with Windows, and I couldn't figure out if this link provides a proper solution (there was no change whether the headphones were plugged in or not).

好的,很贴切,但是我非常感谢您的帮助.

Ok, looong post, but I'd really appreciate the help.

干杯,
卡尔提克.

Cheers,
Karthik.

推荐答案

插孔检测API为(

The jack detection API is (here or here):

snd_jack_new — Create a new jack
snd_jack_set_parent — Set the parent device for a jack
snd_jack_report — Report the current status of a jack 

这篇关于在Ubuntu中使用C/C ++进行线入插孔感应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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