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

MIDI device I/O is not working

    XMLWordPrintable

Details

    • hopper
    • generic, x86, sparc
    • generic, solaris_7, windows_95, windows_98, windows_2000

    Description



      Name: skT45625 Date: 07/26/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)

      When trying to send data to a MIDI device other than the internal java ones
      (such as the java sound synthesizer and the java sequencer), although
      everything appears to be functioning properly, the MIDI device does not receive
      the message. I tested this on many types of devices, including hardware devices
      such as a soundcard's synthesizer and its MPU-401, and on virtual devices which
      create virtual MIDI ports in the operating system such as Hubi's MIDI Loopback
      device v1.5 and a MIDI Monitor program. Here is code that produces the problem:

      <pre>
      // MidiTest.java
      //
      // Given as an example of how the javax.sound.midi.* classes do not work on a
      // Win98 machine.
      //
      // by Nicholas Marrone
      // July 21, 2000

      import javax.sound.midi.*;
      import java.lang.Integer;

      class MidiTest
      {
      public static void main(String[] args)
      {
      MidiDevice.Info[] devices = MidiSystem.getMidiDeviceInfo();

      // If incorrect arguments, just print out a list of the
      available devices
      // and the program's usage
      if (args.length != 1) {
      System.out.println("Usage:\n\tjava MidiTest [midi
      device number]\n");
      for (int x = 0; x < devices.length; x++) {
      System.out.println("\t"+devices[x]);
      }
      }
      // on the correct arguments, send one note to the specified
      midi device
      else {
      try {
      int deviceNum = Integer.parseInt(args[0]);
      MidiDevice md = MidiSystem.getMidiDevice(devices
      [deviceNum]);
      md.open();

      // send the message
      ShortMessage myMsg = new ShortMessage();
      myMsg.setMessage(ShortMessage.NOTE_ON, 0, 60, 93);
      long timeStamp = -1;
      Receiver r = md.getReceiver();
      r.send(myMsg, timeStamp);

      // wait for the not to play
      for (int x = 0; x < 10000; x++) {
      System.out.print("a");
      }

      md.close();
      } catch(Exception e) { System.out.println("Exception
      occurred: " + e); }
      }
      System.exit(0);
      }
      }
      </pre>

      The type of soundcard I am using currently which has the problem has an
      Interwave chip. I have also tested this on a soundcard with a Crystal chip, and
      that soundcard had the same problem.
      (Review ID: 107487)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: