2 summary:: MIDI response reference definition
4 related:: Guides/MIDI, Classes/MIDIdef
7 MIDIdef provides a global reference to the functionality of its superclass link::Classes/MIDIFunc::. Essentially it stores itself at a key within a global dictionary, allowing replacement at any time. Most methods are inherited from its superclass.
9 note:: Use of the older classes MIDIResponder, CCResponder, NoteOnResponder, NoteOffResponder, BendResponder, TouchResponder, and ProgramChangeResponder can be unsafe, since responders in user and class code can override each other unintentionally. MIDIdef and link::Classes/MIDIFunc:: are faster, safer, and have more logical argument order. Thus they are the recommended way of registering for incoming MIDI messages as of SC 3.5.::
16 Get the global dictionary of all MIDIdefs.
18 returns:: An link::Classes/IdentityDictionary::.
21 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.
24 The key at which to store this OSCdef in the global collection. Generally this will be a link::Classes/Symbol::.
27 A link::Classes/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, programme change and bend messages it will be passed only val, chan, and src.
30 An link::Classes/Integer:: indicating the MIDI message number (note number, control number, or programme number) for this MIDIFunc. This can be an array. If nil, the MIDIFunc will respond to messages of all possible message numbers.
33 An link::Classes/Integer:: indicating the MIDI channel number for this MIDIFunc. This can be an array. If nil, the MIDIFunc will respond to messages received on all channels.
36 A link::Classes/Symbol:: indicating which kind of MIDI message this MIDIFunc should respond to. One of code::\noteOn::, code::\noteOff::, code::\control::, code::\touch::, code::\polytouch::, code::\bend::, or code::program::.
39 An link::Classes/Integer:: corresponding to the uid of the MIDI input. (See link::Classes/MIDIClient::.)
42 An optional instance of an appropriate subclass of link::Classes/AbstractDispatcher::. This can be used to allow for customised dispatching. Normally this should not be needed.
44 returns:: An instance of MIDIdef.
47 A convience method to create a new MIDIdef which responds to MIDI control messages. See link::#*new:: for argument descriptions.
49 returns:: An instance of MIDIdef which responds to MIDI control messages.
52 A convience method to create a new MIDIdef which responds to MIDI note on messages. See link::#*new:: for argument descriptions.
54 returns:: An instance of MIDIdef which responds to MIDI note on messages.
57 A convience method to create a new MIDIdef which responds to MIDI note off messages. See link::#*new:: for argument descriptions.
59 returns:: An instance of MIDIdef which responds to MIDI note off messages.
62 A convience method to create a new MIDIdef which responds to MIDI polytouch messages. See link::#*new:: for argument descriptions.
64 returns:: An instance of MIDIdef which responds to MIDI polytouch messages.
67 A convience method to create a new MIDIdef which responds to MIDI touch messages. See link::#*new:: for argument descriptions.
69 returns:: An instance of MIDIdef which responds to MIDI touch messages.
72 A convience method to create a new MIDIdef which responds to MIDI bend messages. See link::#*new:: for argument descriptions.
74 returns:: An instance of MIDIdef which responds to MIDI bend messages.
77 A convience method to create a new MIDIdef which responds to MIDI program change messages. See link::#*new:: for argument descriptions.
79 returns:: An instance of MIDIdef which responds to MIDI program change messages.
83 private:: addToAll, printOn
86 Get this MIDIdef's key.
88 returns:: Usually a link::Classes/Symbol::.
91 Clears this MIDIdef from the global collection and deactivates it.
98 MIDIdef.cc(\test1, {arg ...args; args.postln}, 1); // match cc 1
99 MIDIdef.cc(\test2, {arg ...args; args.postln}, 1, 1); // match cc1, chan 1
100 MIDIdef.cc(\test3, {arg ...args; args.postln}, (1..10)); // match cc 1-10
101 MIDIdef.noteOn(\test4, {arg ...args; args.postln}); // match any noteOn
103 MIDIIn.doNoteOnAction(1, 1, 64, 64); // spoof a note on
104 MIDIIn.doControlAction(1, 1, 1, 64); // spoof a cc
105 MIDIIn.doControlAction(1, 1, 9, 64);
106 MIDIIn.doControlAction(1, 10, 1, 64);