JDK-5053380 : Interface SourceDataLine dose not output sound correctly in j2re 1.5.0beta1.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 5.0
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2004-05-26
  • Updated: 2004-07-09
  • Resolved: 2004-07-09
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 b58Fixed
Related Reports
Duplicate :  
Relates :  
Description

Name: gm110360			Date: 05/26/2004


FULL PRODUCT VERSION :
1.5.0beta-b32c(1.5.0beta1)

ADDITIONAL OS VERSION INFORMATION :
Windows XP SP1

EXTRA RELEVANT SYSTEM CONFIGURATION :
Audio device is SigmaTel C-Major Audio.

A DESCRIPTION OF THE PROBLEM :
In case of  j2re 1.5.0beta1, audio applet, which can work correctly on j2re 1.4.2_04, did not work correctly. Please refer the following  informations.
-sample rate 32000bit/sec, sampleSizeInBits is 16bit, mono, signed, little endian sourceDataLine use.
- It seems distorted audio which could not catch the communication.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1.make sourceDataLine.
2. write audio data.
3. I hear it but output audio is distored.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
1.OK
2.OK
3.I expected audio output correctly in j2re 1.5.0.
ACTUAL -
1.OK
2.OK
3.Audio output Distorted

ERROR MESSAGES/STACK TRACES THAT OCCUR :
nothing.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
create routine:
	
	private static final int SAMPLE_RATE = 32000;
	
	private static final int CHANNEL = 1;
	
	private static final int BITS = 16;


				format = new AudioFormat(SAMPLE_RATE, BITS, CHANNEL, true, false);
				
				DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
				System.err.println(info.toString());
				if(!AudioSystem.isLineSupported(info)){
					System.out.println("Line type is not supported: "+info);
					return;
				}
				try{
					sourceLine = (SourceDataLine)AudioSystem.getLine(info);
					sourceLine.open();
				} catch(LineUnavailableException e){
				  System.out.println(e);
				  sourceLine.close();
				  return;
				}

Output routine:
sourceLine.write(b, off, available);
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
nothing.
(Incident Review ID: 275118) 
======================================================================

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-rc FIXED IN: tiger-rc INTEGRATED IN: tiger-b58 tiger-rc
28-07-2004

EVALUATION Contacted submitter for more information. ###@###.### 2004-06-01 Thanks for the complete test program. It uses in fact a wrong call to SourceDataLine.open: sourceLine.open(); You should use sourceLine.open(format); As the API specifies, open() without any parameters will open it with a "default format", which may well be different for different implementations. For more information, see javadoc for Line.open(). It can be argued that the default format should be set to the format in the DataLine.Info class that was used to retrieve this line, if that Info class only has one format specified. Apparently, the 1.4.2 implementation did that. I leave this bug open to evaluate this. ###@###.### 2004-06-17 The same problem occurs when using Clip's default format: // create an info object info = new DataLine.Info(Clip.class, ais.getFormat()); // get Clip from AudioSystem. This Clip is known to // support our audio format clip = (Clip) AudioSystem.getLine(info); // open the clip clip.open(clip.getFormat(), data, 0, data.length); Apparently, this mis-use of DataLine.Info's audio format is quite common. ###@###.### 2004-06-18 Decided to provide backwards compatibility and add an implementation in 1.5. The specification in the javadoc will be updated to make it official, see bug 5067526 for more info. ###@###.### 2004-06-23
23-06-2004

PUBLIC COMMENTS 1.5 will be fixed so that it remains compatible with older versions. The javadoc will be changed to document this behavior. ###@###.### 2004-06-23
23-06-2004