JDK-4269230 : Java Sound fails to detect and utilize multiple audio output devices
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.3.0
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic,windows_98
  • CPU: generic,x86
  • Submitted: 1999-09-07
  • Updated: 2003-09-27
  • Resolved: 2003-09-27
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Description
The implementation of Java Sound currently constrains the number of 
audio output devices to 1, even if multiple audio output devices are
available on the machine.  Java Sound should detect and allow utilization
of any of the installed audio output devices.  The following mail describes
the problem.

MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Url: http://www.media.mit.edu/~ckline/
Date: Fri, 3 Sep 1999 12:51:08 -0400
Comments: Resent-From: Christopher Kline <###@###.###>
Comments: Originally-From: Christopher Kline <###@###.###>
From: Christopher Kline <###@###.###>
Subject: [JAVASOUND] Is 8-channel output possible in the Java Sound API?
To: ###@###.###

Hello,

I'm trying to use the version of Java Sound included in the JDK 1.3
beta release with the 16-channel Sonorus STUDI/O card. In my NT4.0
system, I can play to any of the 8 stereo output channels using the
standard audio program WinAmp, so I know the card is working.

I have written the following test code:

------------------------------------------------------------
import java.io.*;
import javax.media.sound.*;
import javax.media.sound.midi.*;
import javax.media.sound.sampled.*;
import java.util.*;

public class TestJavaSound
{
  public static void main(String args[])
  {
    NBasicSoundServer server = new NBasicSoundServer();
    Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo();
    System.err.println("\nMixer info length = " +
                        mixerInfo.length + " records");
    for (int i = 0; i < mixerInfo.length; i++)
    {
      System.err.println("\nMIXER " + i + ": " + mixerInfo[i]);
      Mixer m = AudioSystem.getMixer(mixerInfo[i]);
      Line.Info[] sourceInfo = m.getSourceLineInfo();
      for (int j = 0; j < sourceInfo.length; j++)
      {
        System.err.println("\tOUTPUT LINE " + j + ": " + sourceInfo[j]);
      }

      Line.Info[] targetInfo = m.getTargetLineInfo();
      for (int j = 0; j < targetInfo.length; j++)
      {
        System.err.println("\tINPUT LINE " + j + ": " + targetInfo[j]);
      }
    }
    System.err.println("\nDone");
   }
}
------------------------------------------------------------

When I run the code, I get the following output:

------------------------------------------------------------

Mixer info length = 11 records

MIXER 0: Java Sound Audio Engine, version 1.0
        OUTPUT LINE 0: Line of class interface javax.media.sound.sampled.SourceDataLine Source for Mixer com.sun.media.sound.HeadspaceMixer@2bbd86 with 8 formats and buffer size 0 to NOT_SPECIFIED
        OUTPUT LINE 1: Line of class interface javax.media.sound.sampled.Clip Source for Mixer com.sun.media.sound.HeadspaceMixer@2bbd86 with 8 formats and buffer size 0 to NOT_SPECIFIED
        OUTPUT LINE 2: Line of class interface javax.media.sound.sampled.GroupLine Source for Mixer com.sun.media.sound.HeadspaceMixer@2bbd86
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.DataLine Target for Mixer com.sun.media.sound.HeadspaceMixer@2bbd86 with 24 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 1: icrosoft Sound Mapper, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@5f6ccd with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 2: onorus STUDI/O 1 In1, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@601bb1 with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 3: onorus STUDI/O 1 In2, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@3a34f2 with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 4: onorus STUDI/O 1 In3, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@6a2dfe with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 5: onorus STUDI/O 1 In4, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@7182c1 with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 6: onorus STUDI/O 1 In5, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@3f5d07 with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 7: onorus STUDI/O 1 In6, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@74a24a with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 8: onorus STUDI/O 1 In7, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@4ac268 with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 9: onorus STUDI/O 1 In8, version nknown Version
        INPUT LINE 0: Line of class interface javax.media.sound.sampled.TargetDataLine Target for Mixer com.sun.media.sound.SimpleInputDevice@216869 with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

MIXER 10: inOS,waveOut,multi threaded, version nknown Version
        OUTPUT LINE 0: Line of class interface javax.media.sound.sampled.SourceDataLine Source for Mixer com.sun.media.sound.SimpleOutputDevice@4de100 with 32 formats and buffer size NOT_SPECIFIED to NOT_SPECIFIED

Done

------------------------------------------------------------

Notice that only the TargetLines (representing audio input into the
card) show up --- no output channels appear. Does anyone know why this
is happening, or how to send a specific Clip to one of the 8 different
channels?

Is this even supported by the Java Sound API at this time?

thanks!
chris

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger FIXED IN: tiger INTEGRATED IN: tiger tiger-b22
14-06-2004

EVALUATION The implementation of Java Sound currently constrains the number of audio output devices to 1, even if multiple audio output devices are available on the machine. For Win32, the implementation of SimpleOutputDevice should be changed to provide information to and access to all wavOut devices installed on the system. (I don't think supporting multiple sound cards on Solaris is as easy or as important. This would have to be part of a larger effort to detect audio drivers and sound cards on Solaris....) The second and trickier part of the fix is to change the mixer code to use the selected audio output device. kara.kytle@Eng 1999-09-07 ###@###.### 2002-07-15 Can only be solved in a consistent manner by adding direct sound renderers, similar as in JMF. ###@###.### 2002-10-29 Thanks to direct sound renderers in JMF performance packs, this limitation does not exist in JMF. This bug will be fixed in mantis for Linux with ALSA support. Windows and Solaris will have to wait for the next release. ###@###.### 2003-08-23 This bug will be fixed with the inclusion of direct access to - ALSA on Linux - DirectSound on Windows - Solaris Mixer on Solaris ###@###.### 2003-10-01 In response to bhamail: no, Java Sound does not yet have a consistent concept for multi-channel audio, especially mapping of ports to Java Sound lines. We're working on it, though (but will not make it into tiger).
11-06-2004

PUBLIC COMMENTS Java Sound fails to detect and utilize multiple audio output devices
10-06-2004