Ejemplo n.º 1
0
 /**
  * Use this Methode to open an output. You can open an output with its number or with its name.
  * Once the output is opened it is reserved for your program. All opened ports are closed by
  * promidi when you close your applet. You can also close opened Ports on your own.
  *
  * @param outDeviceNumber int, number of the output to open
  * @shortdesc Use this Methode to open an output.
  * @example promidi
  * @related openInput ( )
  */
 public MidiOut getMidiOut(final int midiChannel, final int outDeviceNumber) {
   checkMidiChannel(midiChannel);
   try {
     final String key = midiChannel + "_" + outDeviceNumber;
     if (!openMidiOuts.containsKey(key)) {
       MidiOutDevice midiOutDevice = (MidiOutDevice) midiOutDevices.get(outDeviceNumber);
       midiOutDevice.open();
       final MidiOut midiOut = new MidiOut(midiChannel, midiOutDevice);
       openMidiOuts.put(key, midiOut);
     }
     return (MidiOut) openMidiOuts.get(key);
   } catch (RuntimeException e) {
     e.printStackTrace();
     throw new RuntimeException(
         "You wanted to open the unavailable output "
             + outDeviceNumber
             + ". The available outputs are 0 - "
             + (numberOfOutputDevices() - 1)
             + ".");
   }
 }