MIDIdef provides a global reference to the functionality of its superclass MIDIFunc. Essentially it stores itself at a key within a global dictionary, allowing replacement at any time. Most methods are inherited from its superclass.
Create a new, enabled MIDIdef. If a MIDIdef already exists at this key, its parameters will be replaced with the ones provided (args for which nil is passed will use the old values). Normally one would use one of the message type specific convenience methods below, rather than use this method directly.
key |
The key at which to store this OSCdef in the global collection. Generally this will be a Symbol. |
func |
A Function or similar object which will respond to the incoming message. When evaluated for noteOn, noteOff, control, and polytouch messages it will be passed the arguments val, num, chan, and src, corresponding to the message value (e.g. velocity, control value, etc.), message number (e.g. note number), MIDI channel, and MIDI source uid. For touch, program change and bend messages it will be passed only val, chan, and src. For information on the args passed for the other sorts of |
msgNum |
An Integer indicating the MIDI message number (note number, control number, or program number) for this MIDIdef. This can be an array. If nil, the MIDIdef will respond to messages of all possible message numbers. |
chan |
An Integer indicating the MIDI channel number for this MIDIdef. This can be an array. If nil, the MIDIdef will respond to messages received on all channels. |
msgType |
A Symbol indicating which kind of MIDI message this MIDIdef should respond to. One of |
srcID |
An Integer corresponding to the uid of the MIDI input. (See Using MIDI: MIDIFunc and MIDIdef: Filtering based on device or message data.) If nil, the MIDIdef will respond to messages received from all sources. |
argTemplate |
An optional Integer or Function (or object which responds to the method Methods: matchItem) used to match the value of an incoming MIDI message. (e.g. velocity, control value, program number, etc.). If a Function, it will be evaluated with the message value as an argument, and should return a Boolean indicating whether the message matches and this MIDIdef should respond. |
dispatcher |
An optional instance of an appropriate subclass of AbstractDispatcher. This can be used to allow for customised dispatching. Normally this should not be needed. |
An instance of MIDIdef.
Clears and deactivates all MIDIdefs from the global collection.
A convenience method to create a new MIDIdef which responds to MIDI control messages. See *new for argument descriptions.
An instance of MIDIdef which responds to MIDI control messages.
A convenience method to create a new MIDIdef which responds to MIDI note on messages. See *new for argument descriptions.
An instance of MIDIdef which responds to MIDI note on messages.
A convenience method to create a new MIDIdef which responds to MIDI note off messages. See *new for argument descriptions.
An instance of MIDIdef which responds to MIDI note off messages.
A convenience method to create a new MIDIdef which responds to MIDI polytouch messages. See *new for argument descriptions.
An instance of MIDIdef which responds to MIDI polytouch messages.
A convenience method to create a new MIDIdef which responds to MIDI touch messages. See *new for argument descriptions.
An instance of MIDIdef which responds to MIDI touch messages.
A convenience method to create a new MIDIdef which responds to MIDI bend messages. See *new for argument descriptions.
An instance of MIDIdef which responds to MIDI bend messages.
A convenience method to create a new MIDIdef which responds to MIDI program change messages. See *new for argument descriptions.
An instance of MIDIdef which responds to MIDI program change messages.
A convenience method to create a new MIDIdef which responds to MIDI system exclusive messages. See *new for argument descriptions. The responding func
will be passed the arguments data (an Int8Array) and srcID.
A new instance of MIDIdef which responds to MIDI system exclusive messages.
N.B. Because of SC's underlying low level MIDI implementation, there is no generic msgType
and convenience method for System Common messages. Instead these are grouped with System Realtime under *sysrt below.
A convenience method to create a new MIDIdef which responds to MIDI smpte messages. See *new for argument descriptions. The responding func
will be passed the arguments seconds, framerate, dropframe, and srcID. (dropframe is a Boolean).
A new instance of MIDIdef which responds to MIDI smpte messages.
A convenience method to create a new MIDIdef which responds to MIDI Time Code Quarter Frame messages. Note that the *smpte method above automatically assembles quarter frames into time code. See *new for argument descriptions. The responding func
will be passed the arguments data, srcID, and pieceNumber. You will need to manually assemble each 8 messages into smpte.
A new instance of MIDIdef which responds to MIDI Time Code Quarter Frame messages.
A convenience method to create a new MIDIdef which responds to MIDI song position messages. See *new for argument descriptions. The responding func
will be passed the arguments position and srcID.
A new instance of MIDIdef which responds to MIDI song position messages.
A convenience method to create a new MIDIdef which responds to MIDI song select messages. See *new for argument descriptions. The responding func
will be passed the arguments song and srcID.
A new instance of MIDIdef which responds to MIDI song select messages.
A convenience method to create a new MIDIdef which responds to MIDI tune request messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI tune request messages.
A convenience method to create a new MIDIdef which responds to MIDI clock messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI clock messages.
A convenience method to create a new MIDIdef which responds generically to MIDI System Realtime and System Common messages. Note that the message specific methods above and below are probably more convenient in most cases. Note that this does not include MIDI Time Code Quarter Frame messages (sysrt index 1). For those see *mtcQuarterFrame and *smpte. See *new for argument descriptions. The responding func
will be passed the arguments data (may be nil), srcID, and index. Index indicates the message type as follows:
MIDI Time Code Quarter Frames | 1 |
Song Position | 2 |
Song Select | 3 |
Tune Request | 6 |
MIDI Clock | 8 |
Tick | 9 |
Start | 10 |
Continue | 11 |
Stop | 12 |
Active Sense | 14 |
Reset | 15 |
A new instance of MIDIdef which responds to MIDI System Realtime messages.
A convenience method to create a new MIDIdef which responds to MIDI tick messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI tick messages.
A convenience method to create a new MIDIdef which responds to MIDI start messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI start messages.
A convenience method to create a new MIDIdef which responds to MIDI stop messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI stop messages.
A convenience method to create a new MIDIdef which responds to MIDI continue messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI continue messages.
A convenience method to create a new MIDIdef which responds to MIDI reset messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI reset messages.
A convenience method to create a new MIDIdef which responds to MIDI active sense messages. See *new for argument descriptions. The responding func
will be passed the argument srcID.
A new instance of MIDIdef which responds to MIDI active sense messages.
Clears this MIDIdef from the global collection and deactivates it.