예제 #1
0
  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();
 }