Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4354651

JavaSound won't detect Midi Input ports in J2SE 1.3

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • client-libs
    • generic, x86
    • generic, windows_98



      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)
      ======================================================================

            Unassigned Unassigned
            skondamasunw Suresh Kondamareddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: