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.
The listing of my sound Mixer Infos is:
[0] Java Sound Audio Engine
[1] Built-in Input
[2] USB Advanced Audio Device
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:
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)
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.
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?