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

OSCMKtlDevice
ExtensionExtension

The Modality class for creating and accessing OSC controllers

Description

OSCMKtlDevice provides an internal interface for OSC devices, interfaces or programs that send data to your computer via OSC.

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

When creating an MKtl by desc name, e.g. MKtl(\x, "*drive");, a new OSCMKtlDevice using that description is created. Because actual network ports and addresses may differ from the description file, some adapting may be needed, see Connecting_OSC_devices

For most devices or interfaces, 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 and here: How_to_create_a_description_file_for_OSC

More general info can be found in MKtl and MKtlDevice .

Class Methods

.find

Find all currently opened OSC devices.

Arguments:

post

Whether or not to post about the OSC devices.

.postPossible

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

.protocol

protocol name, \osc.

.initDevices

Initialize the sourceDeviceDict and look for available OSC devices.

Arguments:

force

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

.new

Creates a new instance of OSCMKtlDevice.

Arguments:

name

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

devInfo

The device idInfo to use to make the OSC connections.

parentMKtl

The instance of MKtl that this MKtlDevice will belong to.

multiIndex

if multiple instances are present, indicate which one. (not really used with OSC, mainly for method compatibility with other variants of MKtlDevices.

Instance Methods

.initElements

Initilize all elements and set OSCFuncs for them

.initCollectives

Initilize all collectives and set OSCFuncs for them

.oscFuncDictionary

A Dictionary containing all the OSCFuncs that this device is using.

.closeDevice

Free all OSCFuncs.

.cleanupElementsAndCollectives

De-initialize all elements and collectives.

.send

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

Arguments:

key

The key of the element or collective.

val

The value to which it is set. A collective should send an Array.

.source

The NetAddr device that is the source for this OSCMKtlDevice.

Returns:

an instance of NetAddr

.destination

The NetAddr device that is the destination for this OSCMKtlDevice.

Returns:

an instance of NetAddr

.recvPort

The port to which the OSC device/interface is sending data to. If this is configurable in the OSC device or interface, then it is easier to use sclang's default port of 57120 and leave it undefined.

.updateSrcAddr

Updates the device that is the source for this OSCMKtlDevice and reconfigures OSC communications.

Arguments:

hostname

The hostname or IP address of the source

port

The port of the source

.updateDstAddr

Updates the device that is the destination for this OSCMKtlDevice and reconfigures OSC communications.

Arguments:

hostname

The hostname or IP address of the destination

port

The port of the destination

.updateSrcDstAddr

Updates the device that is both the source and destination for this OSCMKtlDevice and reconfigures OSC communications. Use this method if the source and destination lies in the same program on the same machine.

Arguments:

hostname

The hostname or IP address of the source/destination

port

The port of the source/destination