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

      this.receiver = device.getReceiver();

      this.isInitiated = true;
    }
  }
 private void close() {
   receiver.close();
   device.close();
 }