private void init() throws MidiUnavailableException {
    try {
      if (!(device.isOpen())) {
        device.open();
      }

      this.transmitter = device.getTransmitter();
      this.mrftd = new MidiReceiverForTransmitterDevice();
    } catch (MidiUnavailableException e) {
      device.close();
      throw e;
    }
  }
示例#2
0
  public void open() throws MidiUnavailableException {

    if (input != null && input.isOpen()) {
      return;
    }

    try {
      input = MidiSystem.getMidiDevice(info);
      input.open();
      cl.stateChanged(e);
    } catch (MidiUnavailableException ex) {
      input = null;
      throw ex;
    } catch (IllegalArgumentException ex) {
      input = null;
    }
  }
示例#3
0
 MidiOutput(javax.sound.midi.MidiDevice device) throws MidiUnavailableException {
   this.device = device;
   if (!device.isOpen()) device.open();
   receiver = device.getReceiver();
 }
示例#4
0
 private void checkOpen(MidiDevice device, boolean desiredState) {
   if (device.isOpen() != desiredState) {
     out("device should be " + getStateString(desiredState) + ", but isn't!");
     failed = true;
   }
 }
示例#5
0
 public boolean isOpen() {
   return input != null && input.isOpen();
 }