public List listOutputPorts() {
   List ports = new ArrayList();
   Iterator it = this.outputPortProviders.iterator();
   while (it.hasNext()) {
     try {
       MidiOutputPortProvider provider = (MidiOutputPortProvider) it.next();
       ports.addAll(provider.listPorts());
     } catch (Throwable throwable) {
       throwable.printStackTrace();
     }
   }
   return ports;
 }
  public void removeOutputPortProvider(MidiOutputPortProvider provider) throws MidiPlayerException {
    this.outputPortProviders.remove(provider);

    MidiOutputPort current = getOutputPort();
    if (current != null) {
      Iterator it = provider.listPorts().iterator();
      while (it.hasNext()) {
        MidiOutputPort port = (MidiOutputPort) it.next();
        if (port.getKey().equals(current.getKey())) {
          closeOutputPort();
          break;
        }
      }
    }
  }
 public void addOutputPortProvider(MidiOutputPortProvider provider, boolean tryFirst)
     throws MidiPlayerException {
   this.outputPortProviders.add(provider);
   this.openOutputPort(provider.listPorts(), tryFirst);
 }