Mx scripting interface:
Filter:
Mx/Guides (extension) | Mx

Mx scripting interface
ExtensionExtension

Controlling and connecting units

In order to show things in the simplest way possible, I'll define a few Instr here with some simple sounds. Execute the code below to save them in the Instr library.

Time to play

When you add an object to the Mx it locates the driver for that object and creates an MxUnit to hold it. It starts the object playing or activates it right away.

It placed the sound into the first free channel.

Every object you add will by default get its own channel, or in order to keep things clean you can add new items to the channel.

If you have the gui open then double-click on the pulse to open it in a little window. Move the faders to change the parameters.

Some Magic

I hate it when people don't tell me what's inside something or why it worked. "It just works!" Ok, then tell me what happened please !

Short story: The mx driver for Instr adds adapters for each inlet and outlet. Those support .get and .set and this enables the magic.

For the long story see the bottom of this document.

Add a filter

Look at the gui and you will notice that the Pulse is connected to the fader and the newly added RLPF is also connected to the fader. But the Pulse is not wired to the RLPF.

And now the moment you've all been waiting for

Logically if you want to connect Pulse to RLPF then you want the audio out to the audio in. It just works, yada yada.

c.fader is a reference to the channel's MxChannelFader which does the volume control, mute/solo and also protects the channel audio from blowing up and frightening the children (and polluting the rest of your audio chain with NaNs which will render your concert totally silent).

So enough with the simple stuff already

Long story

In this case an Instr, when added to Mx, will create a Patch internally which is held in the MxUnit. This Patch is the thing that actually plays an Instr. [an Instr is a function, a Patch is an AbstractPlayer subclass that can play that function ]

The Patch has KrNumberEditors for each modulatable input (those that have a ControlSpec). When faders are wiggled then changes are sent to the synth which is playing on the server. [Ok, I glossed over that part, but at this point you can go read the entrails of Patch and KrNumberEditor to see the whole system]

The adapters defined in the mx driver for Instr know how to set values on the NumberEditors.