JDK-4354651 : JavaSound won't detect Midi Input ports in J2SE 1.3
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,windows_98
  • CPU: generic,x86
  • Submitted: 2000-07-19
  • Updated: 2001-03-09
  • Resolved: 2001-03-09
Related Reports
Duplicate :  
Description

Name: skT45625			Date: 07/19/2000


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



//Sample code starts here
package mymidi;

import java.io.*;
import javax.sound.midi.*;


public class test{
       public static void main (String [] args)
       {
           MidiDevice dev;
           MidiDevice.Info [] info = MidiSystem.getMidiDeviceInfo();
           for (int i = 0; i <= info.length - 1; i++)
               {
                   try
                   {
                        dev = MidiSystem.getMidiDevice(info[i]);
                        System.out.println(dev.getDeviceInfo().getName());
                    }
                    catch(MidiUnavailableException e)
                    {
                        System.out.println(e.toString());
                    }
               }
            System.exit(0);
       }
}

//Sample Code ends here


//Sample output starts here
Java Sound Synthesizer
Java Sound Sequencer
MQISA MIDICard Out
//Sample Output ends here

The problem is there is supposed to be MQISA MIDICard IN listed here as well.
MQISA is the Midi Interface Card installed in my PC. MQISA features both MIDI
Output and Input port. MQISA is a MPU-401 compatible and it works fine with
every other MIDI program and Delphi development tools.
(Review ID: 107381) 
======================================================================

Name: yyT116575			Date: 11/15/2000


java version "1.3.0"

The following code does not give a compilation error but it gives run time error
saying that Unavailable transmitter for External midiport; Advance MPU 401.

import javax.sound.sampled.*;
import javax.sound.midi.*;

public class Try1 {

public static void main(String[] args)
{
   MidiDevice.Info[] devices = MidiSystem.getMidiDeviceInfo();
      for(int i = 0 ; i < devices.length ; i++){
	// System.out.println("Here is the list of midi devices with their details: ");
	System.out.println( i+","+devices[i].getDescription()+","+devices[i].getName()+
	   ","+devices[i].getVendor()+ "," +devices[i].getVersion());
      }
     try
     {
	System.out.println(devices[5].getDescription());
   	MidiDevice midi = MidiSystem.getMidiDevice(devices[5]);
	if(midi != null)
	{
	  System.out.println("opening midi");
	  midi.open();
	  System.out.println(" midi opened ");
	}
				 
	System.out.println("getting receiver");
	Receiver rcv = midi.getReceiver();
	System.out.println("receiver got");
	System.out.println ("MAX RECEIVER "+midi.getMaxReceivers());
	if (rcv != null)
	{
	   System.out.print(",OUT");
	}
				 
	System.out.println("message");
	SysexMessage mymessage = new SysexMessage();
	System.out.println(" no message message");
				 
	// byte a[];
	// a = new byte[1];

	// a=c;
	// a[0]=A0;
	// a[1]=1;
	// a[2]=1;
	//a[3]=0;
	// a[4]=10;
	System.out.println("set message");
	// mymessage.setMessage(240,a,247);
	System.out.println("message set ");
				 
	//System.out.println("Sending Message");
	//rcv.send(mymessage,-1);
	//System.out.println("message send");
	System.out.println("getting transmitter");
	Transmitter mytrans = midi.getTransmitter();
	System.out.println("transmitter got");
	if (mytrans != null)
	   System.out.println("i am out");
	midi.close();
     }
     catch(MidiUnavailableException ex){
         System.out.println("Unavailable Exception");
     }
//   catch(InvalidMidiDataException ex){
//       System.out.println(ex);
//   }
//   catch(Exception ex){
//       System.out.println("Exception");
//   }
	
	
   System.exit(0);
}
}
(Review ID: 112308)
======================================================================

Comments
WORK AROUND Name: skT45625 Date: 07/19/2000 There is no work around. ======================================================================
11-06-2004

PUBLIC COMMENTS JavaSound won't detect Midi Input ports in J2SE 1.3 [this feature will be added in a future J2SE release].
10-06-2004

EVALUATION michael.bundschuh@Eng 2000-10-09 The version of Java Sound in J2SE 1.3 does not have support MIDI-input -- this feature will be added in the future. Commit to fix after merlin.
09-10-2000