CHAI SDK  Version 1.3
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
Application messages

Generalities

A message is characterized by its type (Modifier, Selector, Text, DataTransfer), number (a 16 bit value), and optionally index (also a 16 bit value). The role of the message is defined by its message type and number. A given number has a different meaning for a Modifier and a Selector, so you can define 64K Modifier messages along 64K selectors, ... The index value identifies multiple instances of a given message.

A set of standard numbers is defined for each type of message. The set related to modifiers is available from CPNS::Enums::Modifiers. Similar enums exist for Selector, Text and DataTransfer messages. If none of the predefined values matches the message's role, custom values starting from CPNS::Enums::MOD_CustomZoneStart can be used.

Note
Since a message is identified by its type and number, it is very important that messages received on an Input have their unique number for a given message type. It is, for example, not allowed to declare two Parameters bearing the same message type and number behind the same input.

Standard messaging flowing through Outputs, Inputs and Pipes relies on a set of message objects. Each of these objects has a specific role.

BaseMessage

CPNS::IBaseMessage (inheriting from CPNS::IHookedObject) is the base interface for various messages types.

This interface has methods used to extract the appropriate interface depending on the object type. It is mandatory to rely on these methods instead of using a simple type cast.

EventMessage

CPNS::IEventMessage (inheriting from CPNS::IBaseMessage) is used to transport musicality information. By design, MIDI note on/off messages are translated to Event messages.

This message is dedicated to musical events. It can handle information related to the gating, pitch, impulse, and many more. Contrarily to MIDI, each data can be sent separately. For example, a flow of event messages can be used to adjust the pitch without providing any gating or impulse information.

A VoiceID information is available to reconcile messages relating to a specific voice. So, it is possible to generate gating from one source, and pitch from another one. The notion of instrument controller can be split in separate sources, each having a specific role.

ModifierMessage

CPNS::IModifierMessage (inheriting from CPNS::IBaseMessage) is the message for continuous value update. Usually sent by a knob or a slider.

This message always contains a 16-bit value which can be an absolute position or a relative offset. It is up to the target to scale this value into something workable, whose end values match meaningful end-of-scales, application-wise. Optionally, the sender can embed an additional typed value. This is useful if the sender is able to manage such typed value instead of relying on a knob position.

A Modifier message is identified by its number (CPNS::Enums::Modifiers), and optionally an index value allowing a two-dimensional identification.

SelectorMessage

CPNS::ISelectorMessage (inheriting from CPNS::IBaseMessage) offers a choice in a list; typically provided by a dropdown list, push or radio buttons.

This message contains a 16-bit value which can be one of three things: the selected item value, a relative offset from the current selection, or a selection according to a proportional position in the list.

A Selector message is identified by its number (CPNS::Enums::Selectors), and optionally an index value allowing a two-dimensional identification.

TextMessage

CPNS::ITextMessage (inheriting from CPNS::IBaseMessage) is used to send text data.

A Text message is identified by its number (CPNS::Enums::Texts), and optionally an index value allowing a two-dimensional identification.

MIDISysExMessage

CPNS::IMIDISysexMessage (inheriting from CPNS::IBaseMessage) is used to transport SYSEX through CopperLan. There is no size limit; the transfer is done by chunks.

Warning
This kind of message is using handshaking. See CPNS::IInput::DataConsumed.

DataTransferMessage

CPNS::IDataTransferMessage (inheriting from CPNS::IBaseMessage) allows transporting arbitrary data between peers. The maximum payload size is 1024 bytes.

A Data Transfer message is identified by its number (CPNS::Enums::DataTransferNumbers) telling its purpose.

Warning
This kind of message is using handshaking. See CPNS::IInput::DataConsumed.