MKtlElement:
Filter:
Classes (extension) | Libraries > Modality

MKtlElement : MAbstractElement : Object
ExtensionExtension

An element of an MKtl.
Subclasses: MKtlElementGroup

Description

A named element within an MKtl, which typically represents a slider, a button, a joystick axis etc etc. It has a description with a deviceSpec (e.g. \midiNum for a midi faderbox slider), and a type (e.g. \slider). It also has a deviceValue (in the deviceSpec range), and a value (in range 0.0 - 1.0). It is mostly created automatically when an MKtl is made.

See also Creating Custom Elements and Groups.

Class Methods

MKtlElement.types

The types of elements used in descs so far:

MKtlElement.new(name, desc, source)

Creates a new instance, with a name, a description and optionally a source.

The source arg is usually an MKtl.

Inherited class methods

Instance Methods

.deviceSpec

.deviceSpec = newspec

The spec that maps between the numerical value range the device sends and/or receives, and the the unipolar range in the MKtlElement.

.defaultValue

The element's default value

.deviceValue

.deviceValue = newval

From superclass: MAbstractElement

Get and set the element's deviceValue in units and range of the deviceSpec

.value

.value = newval

Get and set the element's current value in normalised range

Arguments:

newval

a Float between 0.0 and 1.0

.valueNoSend = newval

.deviceValueNoSend = newval

Set the element's deviceValue or value without sending back to the hardware device

.valueAction = newval

.deviceValueAction = newval

Set the element's deviceValue or value and perform its action.

Discussion:

deviceValue_ and value_ will not cause the action to be performed. deviceValueNoSend_ and valueNoSend_ will also not trigger the action.

If the element is has an output to send back to the device, value_ and deviceValue_ will send the deviceValue to the device, while deviceValueNoSend_ and valueNoSend_ allow just setting the value without sending it (which is sometimes necessary).

Example: Control a knob on the Behringer BCF2000

.addAction(argAction)

From superclass: MAbstractElement

Add an action to the element's action. Adding multiple actions will create a FunctionList.

.removeAction(argAction)

From superclass: MAbstractElement

Remove an action from the list of current actions. The action to be removed has to be the exact same function object.

.doAction

From superclass: MAbstractElement

Perform the actions related to this element. This includes the action instance variable, and the actions of its parents, up to the containing MKtl.

Arguments:

(sendValue)

Whether or not to send the value out to the device if this is an output element.

.enabled

.enabled = value

From superclass: MAbstractElement

ask whether this element's action is currently enabled

.enable

From superclass: MAbstractElement

.disable

From superclass: MAbstractElement

enable and disable this element's action. works hierarchically in MKtlElementGroup as well:

.resetAction

From superclass: MAbstractElement

Set action to nil.

.asStream

From superclass: MAbstractElement

pattern support - convert MKtlElement to a stream

.embedInStream(inval)

From superclass: MAbstractElement

pattern support - embed MKtlElement in a stream.

.elemDesc

.elemDesc = dict

From superclass: MAbstractElement

An Event or dictionary with a description of the element. Typically contains a deviceSpec, a type, and

.gui(parent, bounds)

From extension in /home/bgola/.local/share/SuperCollider/downloaded-quarks/Modality-toolkit/Modality/Classes/GUI/MKtlElementGUI.sc

Create a gui for this element.

Inherited instance methods

Undocumented instance methods

.prevValue

Examples

Sending data back to MIDI device, one should use MAbstractElement: value_ :

Classic knobs rotating demo for BCF: