Plug-in and Removal of sound devices

Hi,
We're having a problem with USB sound devices. When our application is running, we can't determine if the user has plugged in or removed a sound device. After the first call to AudioSystem.getMixerInfo(), it always returns the same list of devices.
Is there any way to get the list of devices that are currently available?
Here is some example code to illustrate the problem:
import java.io.IOException;
import java.util.List;
import java.util.Vector;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Line;
import javax.sound.sampled.Mixer;
import javax.sound.sampled.SourceDataLine;
import javax.sound.sampled.TargetDataLine;
public class DeviceEnumerator {
    private static List<String> enumerateDevices(Class<?> lineClass) {
        List<String> ret = new Vector<String>();
        for (Mixer.Info mixerInfo : AudioSystem.getMixerInfo()) {
            Mixer mixer = AudioSystem.getMixer(mixerInfo);
            Line.Info lineInfo = new Line.Info(lineClass);
            if (mixer.isLineSupported(lineInfo)) {
                ret.add(mixer.getMixerInfo().getName());
        return ret;
    private static List<String> enumeratePlaybackDevices() {
        return enumerateDevices(SourceDataLine.class);
    private static List<String> enumerateCaptureDevices() {
        return enumerateDevices(TargetDataLine.class);
    private static void findAudioDevices() {
        List<String> playbackDevices = enumeratePlaybackDevices(), captureDevices = enumerateCaptureDevices();
        System.out.println("Found " + playbackDevices.size() + " playback devices:");
        for (String s : playbackDevices) {
            System.out.println("  " + s);
        System.out.println();
        System.out.println("Found " + captureDevices.size() + " capture devices:");
        for (String s : captureDevices) {
            System.out.println("  " + s);
        System.out.println();
    public static void main(String[] args) {
        System.out.println("Press Enter to start ...");
        try {
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        while (true) {
            findAudioDevices();
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                break;
}

850885 wrote:
Is there any way to get the list of devices that are currently available?As far as I know, there's no way to "refresh" the list of devices available on the system...

Similar Messages

  • Lost sound on iMac after plugging in and removing headphones

    Hello, I have a 2006 24 inch Intel Core 2 Duo iMac. It generally works just fine. I run the latest version of Lion.
    However a new problem has started.
    Let's say I am listening to music through the iMac's speaker. That works fine. I then plug my iPhone earphone in or Boss headphones in to the iMac and I get no sound through the headphones.
    I then pull the 1/8th plug out and I now no longer get sound through the speakers.
    The volume is up, it isn't on mute, etc but I get no sound through the speakers or devices plugged into the headphones.
    In the sound syste preferences, the output is set to Internal Speakers, the output volume is set at half and it isn't muted.
    The only way to get the sound back is to restart the machine.
    HELP!
    Thanks
    Andrew

    I don't know if this answers your question at all but I use a program called SoundSource to manager my inputs for the speakers and mic volume when I'm using Skype. This might be something you can use if you're having issues with the volume controls. It stays in the menu bar of the OS and I don't know what I'd do without it.

  • Apple Ipad has been factory reset and removed from manage devices but the new user can't register it under a new ID

    iPad generation 2 has been factory reset, removed from managed devices, apple support, and the device still continues to say it's locked by my ID and cannot be unlocked and registered to a new ID.
    HELP!

    Even if you are sure you have done all of this, do it again slowly and in the order given:
    Prepare your device to sell or give away
    If there is still a problem, post back with the exact complete wording of the error message
    received.

  • Removing Unwanted Sound Devices

    Hi People,
    I had software for Epson data projectors installed which added EPSON Projector Audio to the Sound Devices list in the Sound Preferencepane. I have used the uninstaller to remove the software, but the Sound Device is still listed. I am unable to locate where this file might be so I can remove it manually. Any ideas?
    Andrew

    Then you may find using the freeware, Easy Find, for this. Usually much better than Spotlight for finding such files - you will find it at VersionTracker or MacUpdate.

  • How can I remove a sound device?

    I downloaded some software to try to change my voice during skype calls so I can mess around with my friends, but the softwares didn't work, so I fully uninstalled them, but these devices keep showing up in my sound output/inputs and it is rather annoying. I want to know how to remove them. Please help!
    Oh and I have had plenty experiences with macs so I know what to do when you tell me.

    Have you checked the developers web sites for uninstallers or contacted them for instructions?
    Ciao.

  • Lost sound devices now blue screen of death when updating creative drivers.

    I have an XPS with windows 7, dont k now what the sound card is, I have factory installed software for Creative X something extreme, and Realtex.
    Now I had been trying to get sound via an optical cable to an AV amp with no success. I had tried disabling and re enabling sound devices, then I tried updating the drivers, realtex was ok but the Creative drivers caused the blue screen of death with the message IRQL Not less or equal"
    I tried all options in device manager including rollback, every time I try anything I get that blue screen of death, whats more, in "Sounds" in the control panel, I have lost two of my sound device options that do not appear even with "show hidden devices" so I now have no sound.

    Hi Nambo,
    Device manager should list the exact hardware in your desktop. But normally, integrated audio jacks will appear on the same backplane as other motherboard components, while an add-on card will have its jacks in an expansion slot. So you should know whether you have integrated or add-on.

  • Import: Tracknames from Sound Devices 664??

    Hi All,
    I've just been on a production where the sound was recorded on camera and onto a Sound Devices 664 mixer, but when I import the sound files into FCPX, the metadata from the mixer is not used.
    10 or 12 track files import as 5 or 6 Stereo, not as 10 or 12 mono.
    And the labels set in the mixer, is not put on the seperate tracks. Avid does this fine, so this is very dissapointing since FCPX should be the king of Meta data..
    Any hints?? Or is this just the state of sound support in FCPX??

    I'm using Yosemite OS X 10.10.1. I recalled earlier this year it was OK w/ 10.9 but with the splitted 2 Gb WAV. On SD 7 series, I can set it to split at 2 or 4 Gb. I set it to at 4 Gb to minimize the stitching. But it may be not be a good choice after all if this bug persists. Will retrieve that project to see if it's buggy or not w/ 2 Gb file.

  • Having a MBPr late 2013 and having a sound problem the sound does not come tom the headphones even its all the way up and when i remove the headphones it docent come out the internal speaker either ? any idea how i fix this?

    the sound do not come out the headphones sometimes altho its all the way up in the setting and when i remove the headphones the sound doesnt come from the internal speaker either and only a reboot fixes the problem and thats annoying! any idea how tto fix this?

    Hello. I've been able to play sound without problems through headphones or external speakers to date - the output always switched to these automatically until today. Now, sound output continues through internal speakers even if I plug in headphones or external speakers.
    - I tested the headphones and speakers on other devices: they work fine.
    - When I plug in headphones or speakers into the audio output port (I have verified that I'm not using the input jack) the devices are not detected and are not listed under the output tab in system preferences-sound.
    I concluded from this that I probably had a problem with the audio port, so to test that I tried the following. I plugged a powered multi-USB device with ports for microphone line-in and headphone line-out into the USB port and switched it on. I verified that it was working by plugging a USB stick into the multi-USB device - this was recognised successfully, so the device was clearly working. I then plugged in headphones and speakers into the audio line-out on the multi USB device - but still no sound came through them (and tey were not listed among output devices) and the Mac continued using internal speakers.
    What should I do? Does the latter test suggest that the problem does not lie with the audio port, or is my test not conclusive? What would you advise?
    Many thanks indeed!
    NG

  • My IPAD is not giving any sound it is muted but when head phone plugged in it is giving sound wghat is the problem please answer and solve

    my ipad is not giving any sound from ipad but giving sound from headphone when plugged in, what may be the problem i dont know but facing much problems as phone is muted.I have checked all switches.The sound switch is also on.Red is not visible in rightside switch.
    Please solve the problem,how it is happened whats solution,i want remedia measures
    IPAD 3GS iOS 8.1.2 updated recently but sound muted please solve my problem

    What do you have Settings > General > Use Side Switch Set To ? If 'rotation lock' then you mute/unmute sounds via the Control Centre (swipe up from the bottom edge of the screen), not the switch on the side of the iPad.
    If that is not 'on' then try inserting and removing headphones and see if that gets sounds to work, and if not then try a soft reset (i.e. a reboot) and see if that makes any difference : press and hold both the sleep and home buttons for about 10 to 15 seconds (ignore the red slider), after which the Apple logo should appear

  • My sound won't work on my ipod 5. I plugged the speakers in and it works fine.  When the headphones aren't plugged in and I turn the volume up it says that they are plugged in.  Please help !

    my sound won't work on my ipod 5. I plugged the speakers in and it works fine.  When the headphones aren't plugged in and I turn the volume up it says that they are plugged in.  Please help !

    - Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so. (this was already sugested) There is a little switch in the headphone jack that disconnects the speaker when the headphone jack is inserted.
    Try the following to rule out a software problem
    - Check also Settings > General > Accessibility > Hearing. Make sure that the sound balance is not set all the way to "R".
    - Reset the iPod. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iPod.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack.
    Apple Retail Store - Genius Bar
    If not under warranty Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price                  
    A third-party place like the following will replace the jack for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the jack yourself
    iPod Touch Repair – iFixit

  • What do I do when I plug in my iPod to charge and it says "USB Device not recognized"?

    What do I do when I plug in my iPod to charge and it says "USB Device not recognized"?

    See:
    iOS: Device not recognized in iTunes for Windows
    I would start with
    Removing and reinstalling iTunes and other software components for Windows Vista, Windows 7, or Windows 8
    or
    Removing and Reinstalling iTunes, QuickTime, and other software components for Windows XP
    Run this to help if it identifies the cause
    iTunes for Windows: Device Sync Tests
    Have you tried on another computer to help determine if you have a computer or iPod problem?

  • Should my Computer shows as a device on the Control Panel\Hardware and Sound\Devices and Printers.

    Should my Computer shows as a device on the Control Panel\Hardware and Sound\Devices and Printers.
    Should it? I have an HP p6653w w/ a c7280 all-in-one printer.
    My computer is showing as a device with 'trouble' and it says it has NO driver for it.
    What would happened if I removed that device? Would I again lose the ability to print ??

    Do you have Windows 7?  If so it is normal for the computer to show up in the "Devices" list.  I would suggest you do not delete it.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • On my iPod touch why does it only allow one earphone to play? I've plugged the ear phone kno another device and they worked perfectly fine what is wrong with my iPod

    On my iPod touch why does it only allow one earphone to play? I've plugged the ear phone kno another device and they worked perfectly fine what is wrong with my iPod

    - Try inserting and removing the headphone plug a dozen or so times.
    - Next try a reset. Nothing is lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Restore from backup
    - Restore to factory defaults/new iPod
    If you still have the problem that indicates a hardware problem, like a bad headphone jack.

  • My sound device has been removed

    HP pavilion G series,  Windows xp.. failure to find sound device..  removed some programs that were not being used

    hi Pinball_Wizard,
    Welcome to the Forums.
    CD/DVD issues are commonly fixed by running the microsoft hotfix from this article:
    http://support.microsoft.com/kb/982116
    If the problem is not solved, the issue is most likely hardware related. Either the ODD is faulty or the connection from the ODD from the motherboard is failing. If you don't have an external USB ODD enclosure (like this one) to test the ODD, then you may need to bite the bullet and just replace the ODD directly.
    Best regards,
    neokenchi
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • My phone thinks the headphones are plugged in and I can't get any sounds.  How to fix?

    My iphone 5 thinks that the headphones are plugged in and they are not.  I used them earlier today but they are no longer plugged in to the phone. I can't get any sound (text alerts, ringing, etc) on the phone outside headphones.  Any ideas on how to fix?

    I have resolved my own problem thanks to reviewing other discussions. The solution that worked for me and that was suggested by an Apple store associate some time ago was to plug and unplug my headphone jack into the iPad four times. On the fourth time leave the headphone jack connected and rotate the plug clockwise, then remove and try your sound. When you use the external volume control the HEADPHONE label should be gone. It appears I have to do this now every time after I've used my headphone jack.

Maybe you are looking for