Example #1
0
  /**
   * Searches for the first occurence of a channel with numerical ID <code>id</code>.
   *
   * @return The first occurence of a channel with numerical ID <code>id</code> or <code>null</code>
   *     if there is no channel with numerical ID <code>id</code>.
   */
  public JSChannel findChannel(int id) {
    if (id < 0) return null;

    for (JSChannelsPane cp : getChannelsPaneList()) {
      for (JSChannel c : cp.getChannels()) if (c.getChannelID() == id) return c;
    }

    return null;
  }
Example #2
0
  /**
   * Removes the first occurence of a channel with numerical ID <code>id</code>. This method is
   * invoked when a sampler channel is removed in the back-end.
   *
   * @return The removed channel or <code>null</code> if there is no channel with numerical ID
   *     <code>id</code>.
   */
  public JSChannel removeChannel(int id) {
    if (id < 0) return null;

    for (JSChannelsPane cp : getChannelsPaneList()) {
      for (JSChannel c : cp.getChannels()) {
        if (c.getChannelID() == id) {
          cp.removeChannel(c);
          return c;
        }
      }
    }

    return null;
  }