title: Java Sound API on OS X with USB Sound Card
body: <p>I have a working program written in Java with the Java Sound API that is able to play multiple mp3 audio files at the same time to different USB Sound Cards in the same computer. It works fine in Linux. In Mac OS X, however, it does not.</p>
  
  <p>The listing of my sound Mixer Infos is:</p>
  
  <pre><code>[0] Java Sound Audio Engine
  [1] Built-in Input
  [2] USB Advanced Audio Device
  </code></pre>
  
  <p>If I choose mixer [0] to play the file it does so successfully with the built-in sound card. If I choose mixer [2] to play the file, I get the following exception:</p>
  
  <pre><code>Exception in thread "Thread-1" java.lang.IllegalArgumentException: Line unsupported: interface SourceDataLine supporting format PCM_SIGNED 44100.0 Hz, 16 bit, stereo, 4 bytes/frame, little-endian
  at com.sun.media.sound.SimpleInputDevice.getLine(SimpleInputDevice.java:142)
  at javax.sound.sampled.AudioSystem.getSourceDataLine(AudioSystem.java:633)
  at pt.mobbit.sensorsloader.actuators.multiaudio.AudioPlayer$AudioPlayerThread.run(AudioPlayer.java:135)
  at java.lang.Thread.run(Thread.java:613)
  </code></pre>
  
  <p>However, if I change the Output Device in OS X's System Preferences to be the USB Sound Card, and then in my java application I choose the mixer [0], the sound comes out through the USB Sound card. This leads me to believe that the USB Sound Card can play the mp3 files in OS X as well, just not when it isn't the main output device.</p>
  
  <p>Does anyone know how I can output sound to my usb sound card in OS X without it having to be the system's main output device?</p>