MIDIKtl simple and flexible handling of mappings for midi controllers
MIDIKtl is an abstract class for representing specific midi controllers with subclasses,
such as the PFKtl, JSBKtl, NanoKtl, PDKtl, UC33Ktl, BCRKtl, FFLV2Ktl and more to come.
MIDIKtl subclasses are intended for simple mappings of controllers to JIT interfaces
like ProxyMixer, NdefMixer, NodeProxyEditor, TdefAllGui, PdefAllGui, etc.
A MIDIKtl subclass has a CCResponder that listens to an (optional) MIDI source uid,
and keeps a dictionary for the actions to do when specific MIDI events
from that source comes in.
This is a little more efficient that CCResponder, as there is less matching
going on; and overwriting mappings automatically removes previous actions.
Examples:
PFKtl for the Doepfer PocketFader is the simplest class, which only has faders.
JSBKtl is a subclass for a custom made box with 8 XY joysticks.
NanoKtl for the Korg nanoControl has sliders, knobs, and buttons, and one can switch
between 4 scenes, in which the controls send different sets of cc numbers.
Not updated for the new JITGuis yet:
UC33Ktl is for the Evolution UC33 controller has sliders, knobs, and buttons, and one can switch
between 4 scenes, in which the controls send different sets of cc numbers.
PDKtl for the Doepfer PocketDial has multiple scenes, and can switch modes
between normal knobs (0 .. 127) and endless rotary knob action.
BCRKtl (made with Yvan Volonchine) for the Behringer BCR 2000 motor fader box
supports updating the faders from SC.
FFLV2Ktl for the Faderfox LV2
If you'd like to make a MIDIKtl class for your controller, please see MIDIKtl_howTo.
Not finished yet:
MIDINKtl will also allow mapping actions to note messages.
Class Variables
*defaults a dictionary where each subclass stores clear controller element names
and their midi information.
MIDIKtl.defaults
MIDIKtl.defaults.keys; // currently supported
Controllers without multiple scenes have a single-layer dictionary
MIDIKtl.defaults[PFKtl]
Controllers with multiple scenes have a separate dictionary for each scene:
MIDIKtl.defaults[NanoKtl].postcs
Class Methods
*makeDefaults
Every subclass of MIDIKtl should implement this method to add its dictionary to
the global defaults.
*new (srcID, ccDict)
make a new instance - only meaningful for subclasses of MIDIKtl.
srcID - The MIDI srcID to which to listen.
ccDict - a dict of mappings can be supplied at creation.
Instance Variables
ccDict a dictionary of the mappings used.
ccresp the CCResponder that listen to the srcID.
ctlNames the names of all controller elements and their MIDI keys.
Instance Methods
mapCC (ctl, action)
map an action to a controller element - simple controller, single scene
ctl - a key present in ctlNames
action - the action to evaluate when that controller is used.
mapCCS (scene, ctl, action)
map an action to a controller element - multiple scenes
scene - for which scene to map the controller element
ctl - a key present in ctlNames
action - the action to evaluate when that controller is used.
free
free all resources: remove MIDIResponders, clear dicts.
// utility methods
makeCCKey (chan, cc) convert a cc message to a key
ccKeyToChanCtl (ccKey) convert a key to cc number and message
makeNoteKey (chan, note) convert a chan and note to a key
noteKeyToChanNote (noteKey) convert a key to chan and note