MKtl provides an easy to use interface for devices you can connect to your computer through MIDI, HID, OSC and possibly later Serial and other protocols. Beyond that, you will be able to use it for GUI based controllers.
MKtl.find;
searches for all controllers connected to your machine, and returns a list of available devices. Or, if you already know which controller you want to use, you can create it directly by name, and MKtl will find and return that controller. If it does not find it, e.g. because the physical controller is not there, it creates a virtual MKtl, which can be used to open a GUI that replaces the controller.
For most devices, this requires that someone has made a description file for the device; if there is none, it is easy to make one following the instructions here: How to create a description file
MKtls can also be nested by composing several MKtls; for instance, the iControl ... creates both MIDI and HID devices for communication. For an example and background, see CompMKtl.
all currently available MKtls.
Find all currently connected controllers. This method calls the find method on all of MKtlDevice's subclasses, and will post a list of available MKtl devices.
the currently supported protocols, deviceTypes, and elementTypes used in loaded description files.
Accesses an existing instance of MKtl with the given name, or creates a new instance with that name. As with e.g. JITLib proxies like Ndef, Tdef, Pdef, or OSCdef, MIDIdef etc.
name |
The name of the controller as you want to refer to it. |
lookupNameOrDesc |
The device description or lookupName to be used. This can be:
|
lookForNew |
a flag whether or not to look for newly attached devices or newly added device descriptions. Default is false. Will always look for devices and device descriptions the first time you open an MKtl. |
multiIndex |
if several devices of identical make are present, multiIndex is the index within this array of identical devices. The order is alphabetical by deviceLookupName, and will be reproduceable if the same set of devices is connected. |
tryOpenDevice |
if true, MKtl will try to open the physical device if present. |
A class dictionary of all preset ControlSpecs used by various controller elements.
add and access by name a ControlSpec in MKtl's dictionary of specs
key |
the name by which to store the spec |
(spec) |
The ControlSpec or a symbol or array that can be converted to a spec. |
These methods are all redirected to MKtlDesc.
post the filenames of all loadable device descriptions. For more details on using description files, see MKtlDesc
post all currently loaded device descriptions.
the folder(s) where MKtlDesc finds description files.
open folder(s) at index containing description files.
load device description file(s) matching with name from indicated folder(s).
test whether the given desc is faulty.
post all possible (i.e. currently connected or known) devices for the protocol(s) given. MKtl.postPossible;
make a lookupName for a device based on (typically) its protocol, id number and productName.
get and set the name (a Symbol) of the MKtl. This also changes the name under which the MKtl is stored in Mktl.all.
Open a gui representation for the MKtl, which shows the state of the MKtl's elements and can do all their actions.
a local dict for special specs to use with this MKtl's elements or groups.
the MKtlDesc object that holds the device information from the description file. It is used to build the elements and groups of this MKtl.
For more, see MKtlDesc
Rebuild all elements of the MKtl based on the new description file given.
Open the hardware device for this MKtl if it was not opened already. It will look automatically for an appropriate device.
lookAgain |
Whether or not to look for newly attached hardware devices. |
multiIndex |
Needed when using multiple identical devices to identify which one to create. |
test whether MKtl has a device (a MIDI/HID/OSCMKtlDevice)
Closes the hardware device if it was open.
The instance of MKtlDevice that this MKtl uses. (mktlDevice is a deprecated alias for device)
Frees the MKtl again and forgets about its existence. If there was an device, this closes it.
Reset all actions of the elements in this MKtl
to nil
.
includeGroups |
if |
set the flag whether incoming data are posted or not, default true.
the flag whether incoming data are posted or not.
enable and disable this MKtl, so one can make multiple MKtls (with different setups of elements) for the same physical device.
send all current MKtl values to the physical device, e.g. to move all motorfaders to a freshly recalled preset.
All the control elements (MKtlElement) on the device you may want to listen or talk to. this returns an MKtlElementGroup containing a hierarchical tree of MKtlElements, organised via MKtlElementGroup. (elements is a deprecated alias of elementGroup).
A dict for adding elements or groups by name, so they can be accessed by name. For example, this can be used to reorganize the elements of a fader box into channels as on a mixer. See Creating Named Groups and Coding for Modal Flexibility
An alphabetical list of all elementNames in the MKtl. m = MKtl(\funky); m.elementNames;
A pretty printed hierarchical list of the names and indices of all elements
all elements in one flat event so they can be accessed very fast by name.
return all elements that are of the type given, or not
return all elements which have been given a label
Access an element or group in the elementGroup or in groups by hierarchical indices or names. Supports nil and \all as wildcards, and multi-expands correctly.
Access an element in the elementsDict directly by its full name. This is a very fast lookup. MKtl(\mynano2).dictAt(\sl_1);
Access an element in the collectivesDict by hierarchical name.
Access an element in the top elementGroup by index. MKtl(\mynano2).at(0);
Access an element's value and deviceValue (in the deviceSpec range) by the direct element key
Set an element's value or deviceValue directly by element key
get multiple key/value pairs for a list of element keys. this is intended for more robust storage of presets.
set multiple key/value pairs from a list of key/value arrays.
same as setKeysValues, but with doAction of the elements being set
set multiple key/value pairs from a list of key, value arguments. m.set(\joy_l_x, 1.0.rand, \joy_l_y, 1.0.rand, \joy_r_x,1.0.rand, \joy_r_y, 1.0.rand); m.gui;
same as set, but with doAction of the elements being set
Send the value of the element to the hardware device; called if you set the value of an MKtlElement that is an output.
See How to create a description file for a full discussion on this.
When a device doesn't have a description file yet, explore can be used to help in creating one.
Returns a Boolean whether or not a device is currently being explored.
When a device doesn't have a description file yet, this method can be used to create a description file.
a dict of special messages for this device, typically to change setup on a MIDI device by sending it a sysex message.
send specialMessage with that name to the device
One can add named elements to an MKtl and access them by name. For a full discussion, see Creating Named Groups.
add an element or group to the mktl's namedDict, so they can be accessed by user given names.
This can be used to name single elements by the same function name across different devices - e.g. call one button \play, another \stop, no matter what its name in the device description may be:
These are mainly used internally in OSCMKtlDevice, see How to create a description file for an OSC device