A MIDI client is an entity that can communicate with other MIDI clients, and may have one or more inputs and outputs. Our client will be sort of useless without any I/O, so we create a virtual source into which we can inject our freshly minted MIDI messages. The descriptive string passed in will appear in the MIDI configuration dialogs of any application that supports MIDI, such as my DAW of choice, Ableton Live.
Let's get to the meat of sending a MIDI control message now; we will deal with the packet initialization in a minute. Remember our onControlUpdated()
routine? We can use the mapped control value and the controller index number to build a message to transmit.
midi_control_index ctrlIdx = control->controlIndex(); midi_control_value ctrlVal = control->mappedValue();
ctrlIdx
and ctrlVal
correspond to the number of the MIDI control and the output value for that control respectively. For our ball radius gesture, the control indices will be BALL_RADIUS_HAND_1...