JavaSound:检测设备变化
各位, 我正在开发一个小程序,它从本地计算机捕获音频并将其传输到服务器。我正在使用一个 Java 小程序,该小程序当前挂接到默认设备并执行上游操作。事情进展顺利。
我现在想扩展该功能,以允许用户选择音频输入设备,并在网页中显示所选设备的声级指示器。
我编写了一个多线程实用程序,它会定期执行 AudioSystem.getMixerInfo();
并查找更改。还有一个线程从所选设备读取并显示声音级别。
我的问题是,当我运行代码并插入 USB 耳机时,未检测到新设备。但是,如果我关闭代码,然后插入 USB,该设备就会显示出来。
这是 JavaSound 的一个已知且记录在案的限制,即进程运行后它不会对设备集进行采样?
我正在使用 OSX Lion。
感谢您的任何见解。
-拉吉
Folks,
I am working on an applet that captures audio from the local computer and streams it up to the server. I am using a Java applet that currently hooks onto the default device and performs the upstream. Things are running well.
I now want to extend the functionality to allow users to choose the audio input device and to also show a sound level indicator of the chosen device in the web page.
I wrote a multithreaded utility that would do AudioSystem.getMixerInfo();
periodically and look for changes. There is also a thread that reads from the chosen device and displays sound levels.
My problem is that when I run my code and plug in a USB headset, the new device is not detected. However, if I shut down my code, then plug in the USB, the device does show up.
Is this a known and documented limitation of JavaSound that it does not sample the device set once the process is running?
I am using OSX Lion.
Thanks for any insights.
-Raj
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论