Overview Clamps Packages CM Dictionary Clamps Dictionary Fomus
Next: MIDI Output , Previous: Midi , Up: cl-midictl , Home: General

Clamps Packages

MIDI Ports

Before being able to work with MIDI in/output in Clamps, its MIDI Ports have to get opened. In Clamps, a MIDI port is a struct which contains slots for its id, its midi-input, midi-output and arrays capturing the state of the last MIDI input.

A port gets opened with the open-midi-port function. The function takes an id (a keyword or symbol) and registers the Midi Port with Jack, using the id plus the extensions -in and -out for the in- and output. It also starts MIDI responders, which capture all incoming cc, noteon, noteoff, pitch-bend and after-touch messages in arrays of ref-objects, which are part of the midi-port struct. In addition it creates arrays with lists of functions to call on an incoming cc, note-on, note-off, pitch-bend or after-touch MIDI message, also part of the struct. These lists are initially empty, but the user can push functions with four arguments, denoting opcode, channel, d1 and d2 onto these lists and they will be called automatically, when MIDI messages of the respective type arrive at the midi-input of the port.

On startup, Clamps automatically opens 2 ports, using the function rts, which is called by the clamps function at the beginning of the session. The number of ports can be specified using the :num-midi-ports keyword of the #'clamps function, or by setting the *​num-midi-ports​* parameter in the file ~​/​.clampsinit.

If realtime processing is activated1, the ports should appear in JACK as soon as either the clamps function or (open-midi-port) are called. Closing, accessing and accessing the midi ports an be achieved with the close-midi-port, list-midi-ports and find-midi-port functions.

Footnotes:

1

Starting and stopping realtime processing can be achieved withqn the Keyboard shortcuts <C-c M-.> or <C-c C-.>