MIDIMKtlDevice:
Filter:
Modality-toolkit/Classes (extension) | Libraries > Modality | External Control

MIDIMKtlDevice
ExtensionExtension

The Modality class for creating and accessing external midi controllers

Description

MIDIMKtlDevice provides an internal interface for MIDI controllers you can connect to your computer.

NOTE: Usually, you never access the MIDIMKtlDevice itself, as the MKtl that contains it (its parent MKtl) is the main code interface.

When looking for available devices with MKtl.find(\midi), MIDIMKtlDevice searches for connected controllers, and returns a list of available devices.

When creating an MKtl by desc name, e.g. MKtl(\x, "*nanokontrol2");, MIDIMKtlDevice try to find the matching MIDI ins and outs in the list of available devices and return a MIDIMKtlDevice that contains them. If it does not find it, e.g. because the physical controller is not there, it will return nil. In that case, the MKtl will be virtual, meaning it has no device, and you can still work with it, because it can open a GUI that can replace the controller.

For most devices, this requires that someone has already 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

More general info can be found in MKtl and MKtlDevice .

Class Methods

.find

Find all currently connected MIDI controllers.

Arguments:

post

Whether or not to post about the found MIDI controllers.

.postPossible

Post all access code for device that could be used by name.

.protocol

protocol name, \midi.

.initDevices

Look for available MIDI devices.

Arguments:

force

Whether or not to do this again if it was already done before.

.new

Creates a new instance of MIDIMKtlDevice.

Arguments:

name

The short name of the controller as it shows up in the list of found devices.

idInfo

The lookup idInfo as in MKtlLookup if device is present.

parentMKtl

The instance of MKtl that this MKtlDevice will belong to.

multiIndex

When using multiple identical devices, the index which one to use.

.allMsgTypes

All midi message types supported by MIDIMKtlDevice.

Instance Methods

.enable

.disable

turn this device on and off

.closeDevice

Close the device and clean up anything that it used.

.msgTypes

the midi messages types used by this device

.global

a dict of global response functions for all msgTypes used by this device. This can be used for global responders, e.g. to noteOn/Off messages :

.midiOut

a MIDIOut for this device if present

.midiRawAction

an action to perform with all incoming midi messages, e.g. for logging.

.responders

All responders built for this device

.source

The MIDI source, a MIDIEndPoint.

.srcID

The uid of the source.

.destination

The MIDI destination, a MIDIEndPoint.

.dstID

The uid of the destination.

.explore

When opening a device that is not known yet by MKtl, you want to explore the device. See for a full tutorial: How_to_create_a_description_file

Arguments:

bool

a Boolean to turn this on or off.

.exploring

Whether or not the device is currently being explored.

.createDescriptionFile

Create and open a description file for this MKtlDevice, after exploring it.

.initElements

Initialize all elements and hook them up to the hardware elements.

.cleanupElementsAndCollectives

De-initialize all elements and collectives.

.send

Send the value of the element to the MIDI device; called if you set the value of an MKtlElement that is an output.

Arguments:

key

The key of the element.

val

The value to which it is set.