1 class:: NoteOnResponder
2 summary:: allow functions to be registered to respond to MIDI noteOn events
3 related:: Classes/MIDIFunc, Classes/MIDIdef, Classes/MIDIResponder, Classes/CCResponder
4 categories:: External Control>MIDI
7 note:: SC 3.5 added the link::Classes/MIDIFunc:: and link::Classes/MIDIdef:: classes. These are faster, and aim to have a more convenient, logical and consistent interface, which shares a common design with link::Classes/OSCFunc:: and link::Classes/OSCdef::. They still lack some features of the MIDIresponder classes.::
13 A link::Classes/Function:: to be evaluated. Arguments passed to the function are: src, chan, num, value.
16 The src number may be the system UID (obtained from code:: MIDIClient.sources[index].uid ::) or the index of the source in the code:: MIDIClient.sources :: array. nil matches all.
19 An link::Classes/Integer:: between 0 and 15 that selects which MIDI channel to match. nil matches all. May also be a link::Classes/Function:: which will be evaluated to determine the match. eg: { |val| val < 2 }
22 An link::Classes/Integer:: between 0 and 127 that selects which note number to match. nil matches all. May also be a link::Classes/Function:: which will be evaluated to determine the match. eg: { |val| val >= 4 }
25 An link::Classes/Integer:: between 0 and 127 to filter values. nil matches all. May also be a link::Classes/Function:: which will be evaluated to determine the match. eg: { |val| val < 50 }
28 If true, install the responder automatically so it is active and ready to respond. If false, then it will be inactive.
30 argument::swallowEvent
31 If true, then if the midi event is matched, cease testing any further responders. Note that doing this will prevent any other responders of this type from responding, including ones added behind the scenes in classes. Note also that this functionality is sensitive to the order in which responders are added.
36 Wait for the next noteOn message, reset self to match src, chan.
39 c = NoteOnResponder({ |src,chan,note,vel|
40 [src,chan,note,vel].postln;
42 c.learn; // wait for the first note
44 NoteOnResponder.removeAll
52 c = NoteOnResponder({ |src,chan,note,vel|
53 [src,chan,note,vel].postln;
67 c = NoteOnResponder({ |src,chan,note,vel|
68 [src,chan,note,vel].postln;
72 (50..60), // within this note range