JSR-234 1.1

javax.microedition.amms.control
Interface MIDIChannelControl

All Superinterfaces:
javax.microedition.media.Control

public interface MIDIChannelControl
extends javax.microedition.media.Control

MIDIChannelControl is a Control that gives access to MIDI-channel-specific Controls. Essentially, it provides the same functionality as Controllable, but per channel, not per Player.

A MIDIChannelControl might be supported for MIDI Players.

If the played MIDI file or MIDI stream contains information that is contradictory to what is specified via the MIDIChannelControl the behavior will be implementation specific.

See Also:
Control, Controllable

Method Summary
 javax.microedition.media.Control getChannelControl(java.lang.String controlType, int channel)
          Obtains the object that implements the specified Control interface for the given channel.
 javax.microedition.media.Control[] getChannelControls(int channel)
          Obtains the collection of Controls for the given channel.
 

Method Detail

getChannelControl

javax.microedition.media.Control getChannelControl(java.lang.String controlType,
                                                   int channel)
Obtains the object that implements the specified Control interface for the given channel.

If the specified Control interface is not supported then null is returned.

Parameters:
controlType - the class name of the Control. The class name should be given either as the fully-qualified name of the class; or if the package of the class is not given, the package javax.microedition.media.control is assumed.
channel - number of the channel. It must be in the range 0-15.
Returns:
the object that implements the control, or null
Throws:
java.lang.IllegalArgumentException - thrown if controlType is null or channel is out of range
java.lang.IllegalStateException - thrown if getControl is called in a wrong state. (getControl and getControls cannot be called when the Player is in the UNREALIZED or CLOSED state.)
See Also:
getChannelControls(int channel)

getChannelControls

javax.microedition.media.Control[] getChannelControls(int channel)
Obtains the collection of Controls for the given channel.

Since a single channel can implement multiple Control interfaces, it is necessary to check each object against different Control types. For example:

MIDIChannelControl mc;
// :
Control cs[];
cs = mc.getChannelControls(1);
for (int i = 0; i < cs.length; i++) {
    if (cs[i] instanceof ControlTypeA)
        doSomethingA();
    if (cs[i] instanceof ControlTypeB)
        doSomethingB();
    // etc.
}

The list of Control objects returned will not contain any duplicates and the list will not change over time.

If no Control is supported, a zero length array is returned.

Parameters:
channel - number of the channel. It must be in the range 0-15.
Returns:
the collection of Control objects
Throws:
java.lang.IllegalArgumentException - thrown if the channel is out of range
java.lang.IllegalStateException - thrown if getControls is called in a wrong state. (getControl and getControls cannot be called when the Player is in the UNREALIZED or CLOSED state.)

JSR-234 1.1

Copyright © 2004-2007 Nokia Corporation. See the Copyright for details.