Mx:
Filter:
Mx/Classes (extension) | Mx

Mx
ExtensionExtension

A mixer and dynamic patching

Description

This is the Mx class itself that implements patching and updating. Normal interaction with an Mx is done through the gui (MxGui) and the scripting objects (see MxApp).

The scripting objects (MxApp etc) are designed for efficiency of usage, clarity and convienience. The implementation classes like Mx, MxChannel, MxUnit etc. are designed for efficiency of internal implementation.

Most internal commands for units or channels go through the Mx object which notes all changes like adding or removing of objects or cables in its removing and adding arrays and then performs all these changes on .update. When using the gui or the scripting objects the .update is called automatically.

Class Methods

.new

Arguments:

data

Mx saves a data dump that contains the objects that have been added to it, their connections and their saved state. Each supported class defines its load and save methods in its drivers/ file. The data dump is not especially readable and is not meant to be hand coded or read. A binary format will be introduced later to support Mx with large amounts of data.

endBeat

Relavant to the timeline, this is the total length of the timeline in beats.

loop

Not yet implemented. An Mx may in the future loop in the timeline.

bpm

The bpm as was set in (the global) Tempo when the Mx was saved.

Returns:

an Mx

.defaultFrameRate

See frameRate instance method

Returns:

int

Instance Methods

.app

Returns the MxApp object which is used to communicate with the Mx.

Returns:

an MxApp

.channels

Graphically speaking, each channel is a vertical column in the mixer.

Returns:

an array of MxChannel objects

.cables

MxCable objects connect the outlets and inlets of units together. This is the collection of all cables.

Returns:

an MxCableCollection

.inlets

Just like an individual unit, an Mx can have inlets and can be loaded inside another Mx. (not yet fully implemented)

Returns:

array of MxInlet

.outlets

Just like an individual unit, an Mx can have outlets and can be loaded inside another Mx. (not yet fully implemented) By default an Mx has one audio stereo output. It will be able to have any number and type of outlets. ie. multi channel audio, kr outputs, event stream outputs and even files, images or geometries.

Returns:

array of MxOutlet

.autoCable

When adding audio rate objects, if autoCable is true (default: true) then a cable will be connected from the unit to its channel's fader.

Returns:

boolean

.endBeat

Relavant to the timeline, this is the total length of the timeline in beats.

Returns:

float

.loop

Not yet implemented. An Mx may in the future loop in the timeline.

Returns:

boolean

.bpm

The bpm that the Mx should play at. This sets the global Tempo when play starts and is saved with the Mx document.

Returns:

float. beats per minute

.master

The master MxChannel (on the right side), with channel number inf. Each MxChannel is cabled to the input (top right) of the master channel. Units may be placed in the master channel for master eq, compression etc.

Returns:

.frameRate

Units in an Mx can declared Frame Rate Devices that will be ticked at this rate. SplineFr is an example of a pure Frame Rate Device. Default is 24/beat. The timeline engine uses a frame rate device for its automation.

Returns:

int

.position

a Position object that holds the current play position for the timeline. It updates at every frameRate tick

Returns:

.nextID

Returns:

int

.register

adds an object to an internal registery of all objects and iolets

Arguments:

object
uid

optional

Returns:

uid

.atID

retrieves an object from the registry

Arguments:

uid

Returns:

object

.findID

find registery object for id

Arguments:

object

Returns:

uid

.unregister

Arguments:

uid

.registerUnit

Arguments:

unit
uid

.registerChannel

Arguments:

channel
uid

.findMasterInput

locate or make an input unit on the master channel

Returns:

.add

create a new channel and add one or more objects to it

Arguments:

... objects

Returns:

.channelAt

Arguments:

chan

Returns:

.indexOfChannel

Arguments:

channel

Returns:

int

.extendChannels

Arguments:

toSize

.insertChannel

Create a channel at the index and add objects to it

Arguments:

index
objects

Returns:

.putChannel

Create a channel, replacing any previous channel at this index. Add supplied objects to it

Arguments:

index
objects

Returns:

.removeChannel

Arguments:

index

.prRemoveChannel

Arguments:

index

.prMakeChannel

Arguments:

units

Returns:

.addOutput

Add a new output. Default is one stereo audio out. Adding an output adds additional MxOutlets to the Mx

Arguments:

rate

Symbol

numChannels

int

Returns:

.at

Retreive the MxUnit at the channel and index. returns nil if unoccupied

Arguments:

chan

int

index

int

Returns:

.put

put an object at channel @ index, wrapping it in an MxUnit

Arguments:

chan

int

index

int

object

object

Returns:

.copy

Arguments:

fromChan
fromIndex
toChan
toIndex

Returns:

.prMakeUnit

Arguments:

object

Returns:

.prPutToChannel

Arguments:

channel
index
object

Returns:

.putMaster

Arguments:

index
object

Returns:

.move

Arguments:

chan
index
toChan
toIndex

.remove

schedules the object at chan@index to be removed at the next update. removes the object from the grid (if any) immediately.

Arguments:

chan
index

.insert

Arguments:

chan
index
object

Returns:

.removeUnit

remote the unit, whever it is located. see remove

Arguments:

unit

.pointForUnit

find the chan@index point for a unit

Arguments:

unit

Returns:

Point or nil for private units like the fader's unit

.unitAddFrameRateDevices

call the unit's handlers offering it the chance to add frame rate devices.

Arguments:

unit

.addFrameRateDevice

add a frame rate device : a function that will be called at frame rate (default 24/s)

Arguments:

func
forUnit

unit that owns the frame rate device

Returns:

.removeFrameRateDeviceForUnit

Arguments:

unit

.initialTick

set position to 0.0 and set frame rate devices to 0.0

.startTicker

Arguments:

bundle

MixedBundle

.stopTicker

Arguments:

bundle

MixedBundle

.beatDuration

longest duration of any unit. total length of the song.

Returns:

float

.getInlet

Arguments:

point
index

Returns:

.getOutlet

Arguments:

point
index

Returns:

.connect

make a connection, adding an MxCable. actual connection happens on next update

Arguments:

fromUnit
outlet
toUnit
inlet
mapping

.disconnect

Arguments:

fromUnit
outlet
toUnit
inlet

.disconnectCable

Arguments:

cable

.disconnectUnit

Arguments:

unit

.disconnectInlet

Arguments:

inlet

.disconnectOutlet

Arguments:

outlet

.mute

Arguments:

channel
boo

.solo

Arguments:

channel
boo

.gotoBeat

Arguments:

beat
q
bundle

MixedBundle

.update

Enact all changes to the server after things have been added/removed dis/connected. So .add and .remove etc are called, then .update is called that syncs the server to the new state in one bundle.

Arguments:

bundle

MixedBundle or nil

If bundle is supplied then it will not send it and will return the bundle. If nil then it creates and sends the bundle.

Returns:

.updateVarPooling

set up parent chain of unit environments that participate in varPooling

.allUnits

iterator over all units

Arguments:

includeChanUnit

boolean each MxChannel has an MxUnit for its fader. you may wish to exclude those and just iterate over the units on the grid.

Returns:

Routine

.clearPending

very private clears any state changes requested through .add and .remove

.children

all channels including the master channel

Returns:

array of MxChannel

.loadDefFileToBundle

Arguments:

b
server

.prepareChildrenToBundle

Arguments:

bundle

MixedBundle

.spawnToBundle

Arguments:

bundle

MixedBundle

.spawnCablesToBundle

Arguments:

bundle

MixedBundle

.updateAutoCables

Returns:

array of MxCable

.stopToBundle

Arguments:

bundle

MixedBundle

.gui

Arguments:

parent
bounds

Returns:

MxGui

.guiClass

Returns:

MxGui

.draw

Arguments:

pen
bounds
style

Examples