JDK-4836434 : Linux: MidiFileWriter does not work if Java Sound Engine is disabled
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.4.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2003-03-24
  • Updated: 2004-04-02
  • Resolved: 2004-04-02
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.
5.0 b46Fixed

Name: fb126949			Date: 03/23/2003

When the Java Sound Audio Engine is disabled (e.g. by renaming /dev/dsp) and only ALSA drivers are enabled, then test 95 of the Java Sound test suite fails with this exception:

java.lang.IllegalArgumentException: Could not write MIDI file
	at com.sun.media.sound.StandardMidiFileWriter.write(StandardMidiFileWriter.java:139)
	at javax.sound.midi.MidiSystem.write(MidiSystem.java:778)
	at test095.runTest(test095.java:123)
	at test095.main(test095.java:212)

The test just writes a self-generated Sequence to a ByteArrayOutputStream. When the Java Sound Audio Engine is enabled, the test passes.


CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: tiger-beta2 FIXED IN: tiger-beta2 INTEGRATED IN: tiger-b46 tiger-beta2

PUBLIC COMMENTS Fixed by not returning an instance of Syntyhesizer if the Java Sound Audio Engine is not available.

EVALUATION ###@###.### 2003-03-23 Don't know the cause for this. Midi File Writers should always work independent of the audio hardware. The test get the default synthesizer and queries it for the maximum polyphony. Then it constructs a sequence with as many events as the polyphony allows. Now if the audio device is not accessible, the synthesizer returned 0 polyphony, and the test tried to write a MIDI file with 0 tracks. Therefore, it failed. These fix were made: 1) Java Sound should not return the Java Sound Engine Synthesizer, or its Sequencer, if the Java Sound Audio Engine is not available. So, from now on, You will not be able to get a Synthesizer if no audio device is accessible. 2) the test case was fixed: 2a) it does not fail if there is not default synthesizer 2b) it does fail with a meaningful error message, if the default synthesizer has 0 polyphony. ###@###.### 2004-03-29