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

MAbstractElement
ExtensionExtension

Base class for MKtl controller elements.

Description

Abstract class for MKtl controller elements and groups. It provides the common interface that individual MKtlElements (which represent single sliders, buttons, etc) and MKtlElementGroups share.

NOTE: This is an abstract class that should usually not be used directly.

(Theoretically, one could use MAbstractElement like an MKtlElement without specs.)

Class Methods

.new

create a new instance, with a name, and the MKtl it will belong to.

Instance Methods

.source

the MKtl the element belongs to.

.name

the element's name

.type

the type of the element, e.g. \button, \slider, \knob. See MKtl_description_files for a more detailed list.

setting and getting values

.value

Get and set the element's value. with MKtlElementGroup, value is the collected values of its element. Note that value_ does not evaluate any action.

Arguments:

newval

the new value

.prevValue

the previous value

.valueAction

Set value and evaluate the associated action.

Arguments:

newval

the new value

.doAction

Evaluate the associated action (without changing the value)

Adding and removing functionality

.action

Get and set the action to evaluate when element is activated.

.addAction

add an action to potentially already present actions

.removeAction

remove an action the present list of actions

.resetAction

.reset

reset element action to nil, i.e. without any actions.

Groups

.parent

returns the parent group of the element in the MKtl elements hierarchical structure.

.groups

if the element is inside one or more groups, and those groups have an action assigned, they will be returned here.

Discussion:

Groups are instances of MKtlElementGroup.

.index

.indexInGroup

returns the index (Number) of this inside its parent group

.indices

returns an array of indices that points to this from the top level of the MKtl elements hierarchy. These values correspond with MKtl: elAt

.key

.keyInGroup

returns the key (Symbol) of this inside its parent group

.keys

returns an array of keys that points to this from the top level of the MKtl elements hierarchy. These values correspond with MKtl: elAtkeys and indices can be mixed, see MKtlElementGroup.

UGen support

.kr

Use the value directly on the server (on a bus).

Arguments:

server

optional argument that you only have to set once, and only if the server for the bus is not Server: -default.

Returns:

an In: -kr holding the current value of this element. Reflects changes of the value.

.initBus

initialize the bus on the server.

Arguments:

server

The server the bus should be instantiated on. Default value is Server: -default.

.freeBus

frees the bus.

.bus

A Bus that holds the element's value.

Discussion:

Normally, you should just reference to this bus via the -kr which will also take care of creating the bus when needed.

Tagging

Tagging allows adding tags to controller elements. The tagging system is flat, i.e. only elements have tags, MKtlElementGroup (and its derivatives) do not - it forwards tagging requests to its children.

.tags

all tags of this element.

Returns:

list of Symbols

Discussion:

If this is an MKtlElementGroup, it returns a combined list of all tags of its child elements.

.addTag

add tags to the element

Arguments:

... newTags

list of Symbols

Discussion:

If this is an MKtlElementGroup, it forwards this call to its child elements.

.removeTag

remove tags from the element

Arguments:

... newTags

list of Symbols

Discussion:

If this is an MKtlElementGroup, it forwards this call to its child elements.

.includesTag

searches for specific tag

Arguments:

... tag

list of Symbols

Returns:

true, if all tags specified in the argument are found, otherwise false.

Discussion:

If this is an MKtlElementGroup, it forwards this call to its child elements.

.clearTags

wipes all tags from the element

Discussion:

If this is an MKtlElementGroup, it forwards this call to its child elements.