libnmProtocol - Nord Modular Protocol Library
The Nord Modular Protocol Library can send and receive messages to and from the Nord Modular Synthesizer. NM Protocol messages are encoded into one or more SysEx messages sent over MIDI to the synth. On message reception from the synth, all registered listeners are notified.
The communication is driven by a heartbeat method that must be called frequently. This method can for example be called from a timer interrupt set up in the GUI toolkit used in the application.
The protocol library depend on libPDL for encoding and decoding of binary protocol data. The PatchMessage also depends on libNMPatch for read and write of patch data.
To make the library platform independent, a number of MIDI APIs need to be handled separately. This is done through a single MidiDriver interface, which supplies the functionality the rest of the protocol library needs.
Under the control of compile time flags, the various concrete MidiDriver classes are compiled into the library. The available drivers can be queried and instantiated at runtime through static methods in the MidiDriver class.
libNMProtocol Control Language
To start communicating with a synthesizer, an object of the class NMProtocol is instantiated and given a MidiDriver object to use. The object then needs to be driven by regular calls to the NMProtocol.heartbeat() method.
Listeners can be attached to the NMProtocol object. All listeners are notified when a message is received from the synthesizer.
To send a message to the synth, one of the message classes needs to be instantiated and then given as argument to the NMProtocol.send() method. The method extracts the SysEx streams from the message object and enqueues them for later transmission.
|From PC||NM reply||Note|
|RequestPatchMessage||AckMessage||Fetch current pid.|
|GetPatchMessage||PatchMessage||One reply per patch section.|
The protocol library uses libPDL both for the SysEx coding, and for patch message coding. The protocol format is described in the files midi.pdl and patch.pdl.