JDK-4984861 : Support multiple SourceDataLine on system with multiple sound cards
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2004-01-28
  • Updated: 2004-01-28
  • Resolved: 2004-01-28
Related Reports
Duplicate :  
Description

Name: gm110360			Date: 01/28/2004


A DESCRIPTION OF THE REQUEST :
For systems with multiple sound cards, only multiple TargetDataLines are supported in Java Sound. This enables programmers to capture from a specific audio device if more than one are present, regardless of the OS's default/preferred recording device. This is really nice.

However, for SourceDataLine, there's only one mixer usable, which is the "Java Sound Audio Engine". This "software" mixer is always tied to the OS's default playback device. Trying to get the SourceDataLine from any "hardware" mixer will always cause an exception saying the audio format is unsupported. This makes it impossible to control playback on different audio devices - you always have to use the system default one.
  To fully understand the behavior of Java sound, I used a program to enumerate all the mixers from AudioSystem, then for each mixer, try opening SourceDataLine and TargetDataLine with each of the possible audio formats. The results are (a table):
Mixer,                   Hardware map      SourceDataLine?    TargetDataLine?
Java Sound Audio Engine, default OS playback device, all audio formats, none;
Microsoft Sound Mapper, default OS capture device, none, all formats;
<Hardware audio device1>, sound card #1, none, all audio formats;
<Hardware audio device2>, sound card #2, none, all audio formats;
...


JUSTIFICATION :
Getting SourceDataLine from hardware mixers allows:
1) total control on audio devices (playback AND capture) for machines with multiple sound cards, all done from within a Java program.
2) beauty of symmetry between playback (SourceDataLine) and capture (TargetDataLine)
3) JMF will also have the capability to specify arbitrary playback device

EXPECTED VERSUS ACTUAL BEHAVIOR :
Obtain a "hardware" mixer from AudioSystem that directly corresponds to a hardware sound card, then can call getLine() with a SourceDataLine type and any audio format already supported by the TargetDataLine. After obtaining this SourceDataLine, can open and start it and play back sound. The sound comes out of the sound card's output jack regardless of what OS's default playback device is.
After obtaining a "hardware" mixer, getLine() with a SourceDataLine type always throws exception (complaining about the audio format). None of the standard audio formats are supported, even though they work for TargetDataLines.

---------- BEGIN SOURCE ----------
i'll be glad to send the mixer-line enumeration program if you desire.
---------- END SOURCE ----------
(Incident Review ID: 182650) 
======================================================================

Comments
PUBLIC COMMENTS Support multiple SourceDataLine on system with multiple sound cards
10-06-2004

EVALUATION This is fixed with addition of direct audio in 1.5.0. See bugs 4908240, 4233634, 4908879, 4347309. ###@###.### 2004-01-28
28-01-2004