K

Ports

The IO helpers for declaring a device's plugs.

Ports are declared in describe with m.addPort(...). A device may declare any number of each kind.

HelperHandleKind
audioIn(label, channels)audio-inAudio input
sidechainIn(label, channels)audio-in-sidechainSidechain input
audioOut(label, channels)audio-outAudio output
midiIn(label)midi-inMIDI input
midiOut(label)midi-outMIDI output
modulationOut(label)modulation-out, then modulation-out-1, ...Modulation source (up to 8 per node)
m.addPort(audioIn("In", 2));
m.addPort(sidechainIn("SC", 2));
m.addPort(audioOut("Out", 2));
m.addPort(midiOut("MIDI"));

The host builds the buses and wire handles from the manifest, exactly like a plugin's dynamic buses, so the ports just route.

Reading and writing

  • Audio: ctx.input(ch, i) and ctx.output(ch, i, v). A sidechain's channels follow the main input's. Loop over ctx.inChannels().
  • MIDI: ctx.midiInCount() / ctx.midiInByte(...) to read, ctx.emitMidi(...) to send. See the device API.
  • Modulation: ctx.modOut(i, value) writes the primary modulation output; ctx.modOutAt(out, i, value) writes output out (declaration order, 0 = the primary) on a multi-output device. See Be a modulation source.