JDK-4380283 : MidiSystem.getMidiDeviceInfo() works but prevents my test program from exiting
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_98
  • CPU: x86
  • Submitted: 2000-10-18
  • Updated: 2002-10-29
  • Resolved: 2002-10-29
Related Reports
Duplicate :  
Description

Name: yyT116575			Date: 10/17/2000


java version "1.30"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

The following code works as expected but the complied class when run doesn't
finish; I have to CTRL-C kill it. I'm guessing some thread started by
getMidiDeviceInfo() is caught in a loop or something -- the problem remains if
main is only the single line:
  MidiDevice.Info[] devices = MidiSystem.getMidiDeviceInfo();

( Note also that I didn't submit this bug with any of the listed categories as
the javax.sound.* packages weren't listed as a category. Does this mean these
packages are *not* part of the Java Media Framework? )

///
// Testing MidiSystem.getMidiDeviceInfo()

import javax.sound.midi.*;

public class MyMidi
{
	public static void main (String[] args) {
		MidiDevice.Info[] devices = MidiSystem.getMidiDeviceInfo();
		
		for (int i=0;i<devices.length;i++) {
			System.out.println(devices[i].getName());
			System.out.println(devices[i].getDescription());
		}
	}
}

Not a big issue but a bug nontheless.

Jason Boyd
(Review ID: 110898) 
======================================================================

Comments
EVALUATION ###@###.### 2002-10-29 Same problem as for sampled audio: the event dispatcher thread is non-daemon and prevents apps from exiting. MidiSystem uses sampled audio classes for playback, so the event dispatcher is also created for MIDI apps. Close as duplicate of 4735740.
11-06-2004

WORK AROUND Name: yyT116575 Date: 10/17/2000 Programmers can simply try calling MidiSystem.getMidiDevice() sequentially using a few hard-coded MidiDevice.Info objects, but I don't see an obvious workaround to be able to query the available devices seeing that this is the only API method provided to do this. ======================================================================
11-06-2004