JavaSound: Detect device change

不羁的心 提交于 2020-01-24 19:20:29

问题


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

来源:https://stackoverflow.com/questions/7390942/javasound-detect-device-change

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!