0

Is it possible to identify if a microphone has been physically unplugged and replugged using the java Sound API?

More specifically, if I have an open line and the microphone is disconnected and reconnected the list returned by AudioSystem.getMixerInfo() does not change and the line remains open but recording stops. Is there a way to find out about such disconnect/reconnect events (without using native calls) ?

msam
  • 4,259
  • 3
  • 19
  • 32
  • maybe this will help: http://www.developer.com/java/other/article.php/2105421/Java-Sound-Capturing-Microphone-Data-into-an-Audio-File.htm – Adel Boutros Mar 05 '12 at 09:45
  • Good introduction but does not help. The reason for the list not changing between calls to `getMixerInfo` is that the `JDK13Services` class caches the list of devices that are returned by `getMixerInfo` – msam Mar 06 '12 at 12:53
  • @msam I had the same problem and also used the JDK13Services for detecting a microphone, but I am still not able to use its Lines. Did you succeed in doing so? Please comment or answer to my question if you have a solution here: http://stackoverflow.com/questions/9874713/java-sound-refresh-lines-list-after-attaching-a-microphone . Thanks. – Alex Fedulov Mar 26 '12 at 15:17

0 Answers0