Vuo  2.0.0
Classes | Macros | Functions | Variables
VuoMidi.cc File Reference

Description

VuoMidi implementation.

Definition in file VuoMidi.cc.

Go to the source code of this file.

Classes

struct  VuoMidiIn_internal
 Private data for a VuoMidiIn instance. More...
 

Macros

#define setRealizedDevice(newDevice)
 Helper for VuoMidiInputDevice_realize. More...
 

Functions

VuoList_VuoMidiInputDevice VuoMidi_getInputDevices (void)
 Returns a list of the available MIDI input devices. More...
 
VuoList_VuoMidiOutputDevice VuoMidi_getOutputDevices (void)
 Returns a list of the available MIDI output devices. More...
 
static void VuoMidi_reconfigurationCallback (const MIDINotification *message, void *refCon)
 Invoked by Core MIDI. More...
 
void VuoMidi_use (void)
 Indicates that the caller needs to get notifications about MIDI devices. More...
 
void VuoMidi_disuse (void)
 Indicates that the caller no longer needs notifications about MIDI devices. More...
 
void VuoMidi_addDevicesChangedTriggers (VuoOutputTrigger(inputDevices, VuoList_VuoMidiInputDevice), VuoOutputTrigger(outputDevices, VuoList_VuoMidiOutputDevice))
 Adds a trigger callback, to be invoked whenever the list of known MIDI devices changes. More...
 
void VuoMidi_removeDevicesChangedTriggers (VuoOutputTrigger(inputDevices, VuoList_VuoMidiInputDevice), VuoOutputTrigger(outputDevices, VuoList_VuoMidiOutputDevice))
 Removes a trigger callback previously added by VuoMidi_addDevicesChangedTriggers. More...
 
void VuoMidiOut_destroy (VuoMidiOut mo)
 Destroys a MIDI output device manager. More...
 
VuoMidiOut VuoMidiOut_make (VuoMidiOutputDevice md)
 Creates a reference-counted object to manage sending messages to a MIDI device. More...
 
void VuoMidiOut_sendNote (VuoMidiOut mo, VuoMidiNote note)
 Outputs the specified note event through the specified MIDI output device mo. More...
 
void VuoMidiOut_sendController (VuoMidiOut mo, VuoMidiController controller)
 Outputs the specified controller event through the specified MIDI output device mo. More...
 
void VuoMidiOut_sendPitchBend (VuoMidiOut mo, VuoMidiPitchBend pitchBend)
 Outputs the specified pitchBend event through the specified MIDI output device mo. More...
 
void VuoMidiIn_receivedEvent (double timeStamp, std::vector< unsigned char > *message, void *userData)
 RtMidi calls this function ("on a separate high-priority thread owned by CoreMIDI") every time it receives a MIDI event. More...
 
void VuoMidiIn_destroy (VuoMidiIn mi)
 Destroys a MIDI input device manager. More...
 
VuoMidiIn VuoMidiIn_make (VuoMidiInputDevice md)
 Creates a reference-counted object to manage receiving messages from a MIDI device. More...
 
void VuoMidiIn_enableTriggers (VuoMidiIn mi, void(*receivedNote)(void *context, VuoMidiNote note), void(*receivedController)(void *context, VuoMidiController controller), void(*receivedPitchBend)(void *context, VuoMidiPitchBend pitchBend), void *context)
 Sets up the MIDI input device to call the trigger functions when it receives an event. More...
 
void VuoMidiIn_disableTriggers (VuoMidiIn mi)
 Stops the MIDI input device from calling trigger functions when it receives an event. More...
 
bool VuoMidiInputDevice_realize (VuoMidiInputDevice device, VuoMidiInputDevice *realizedDevice)
 If device's ID or name is unknown: More...
 
bool VuoMidiOutputDevice_realize (VuoMidiOutputDevice device, VuoMidiOutputDevice *realizedDevice)
 If device's ID or name unknown: More...
 

Variables

static VuoTriggerSet< VuoList_VuoMidiInputDeviceVuoMidi_inputDeviceCallbacks
 Trigger functions to call when the list of midi input devices changes. More...
 
static VuoTriggerSet< VuoList_VuoMidiOutputDeviceVuoMidi_outputDeviceCallbacks
 Trigger functions to call when the list of midi output devices changes. More...
 
unsigned int VuoMidi_useCount = 0
 Process-wide count of callers (typically node instances) interested in notifications about midi devices. More...
 
MIDIClientRef VuoMidi_client
 Core MIDI client, for device notifications. More...
 

Macro Definition Documentation

◆ setRealizedDevice

#define setRealizedDevice (   newDevice)
Value:
realizedDevice->id = newDevice.id; \
realizedDevice->name = VuoText_make(newDevice.name);

Helper for VuoMidiInputDevice_realize.

Definition at line 435 of file VuoMidi.cc.

Function Documentation

◆ VuoMidi_addDevicesChangedTriggers()

void VuoMidi_addDevicesChangedTriggers ( VuoOutputTrigger(inputDevices, VuoList_VuoMidiInputDevice ,
VuoOutputTrigger(outputDevices, VuoList_VuoMidiOutputDevice  
)

Adds a trigger callback, to be invoked whenever the list of known MIDI devices changes.

Call VuoMidi_use() before calling this.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 151 of file VuoMidi.cc.

◆ VuoMidi_disuse()

void VuoMidi_disuse ( void  )

Indicates that the caller no longer needs notifications about MIDI devices.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 123 of file VuoMidi.cc.

◆ VuoMidi_getInputDevices()

VuoList_VuoMidiInputDevice VuoMidi_getInputDevices ( void  )

Returns a list of the available MIDI input devices.

Definition at line 52 of file VuoMidi.cc.

◆ VuoMidi_getOutputDevices()

VuoList_VuoMidiOutputDevice VuoMidi_getOutputDevices ( void  )

Returns a list of the available MIDI output devices.

Definition at line 70 of file VuoMidi.cc.

◆ VuoMidi_reconfigurationCallback()

static void VuoMidi_reconfigurationCallback ( const MIDINotification *  message,
void *  refCon 
)
static

Invoked by Core MIDI.

Definition at line 88 of file VuoMidi.cc.

◆ VuoMidi_removeDevicesChangedTriggers()

void VuoMidi_removeDevicesChangedTriggers ( VuoOutputTrigger(inputDevices, VuoList_VuoMidiInputDevice ,
VuoOutputTrigger(outputDevices, VuoList_VuoMidiOutputDevice  
)

Removes a trigger callback previously added by VuoMidi_addDevicesChangedTriggers.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 165 of file VuoMidi.cc.

◆ VuoMidi_use()

void VuoMidi_use ( void  )

Indicates that the caller needs to get notifications about MIDI devices.

This function may be called from any thread.

Changed in Vuo 2.0.0:
New.

Definition at line 103 of file VuoMidi.cc.

◆ VuoMidiIn_destroy()

void VuoMidiIn_destroy ( VuoMidiIn  mi)

Destroys a MIDI input device manager.

Definition at line 424 of file VuoMidi.cc.

◆ VuoMidiIn_disableTriggers()

void VuoMidiIn_disableTriggers ( VuoMidiIn  mi)

Stops the MIDI input device from calling trigger functions when it receives an event.

This function may be called from any thread.

Definition at line 409 of file VuoMidi.cc.

◆ VuoMidiIn_enableTriggers()

void VuoMidiIn_enableTriggers ( VuoMidiIn  mi,
void(*)(void *context, VuoMidiNote note)  receivedNote,
void(*)(void *context, VuoMidiController controller)  receivedController,
void(*)(void *context, VuoMidiPitchBend pitchBend)  receivedPitchBend,
void *  context 
)

Sets up the MIDI input device to call the trigger functions when it receives an event.

This function may be called from any thread.

Definition at line 385 of file VuoMidi.cc.

◆ VuoMidiIn_make()

VuoMidiIn VuoMidiIn_make ( VuoMidiInputDevice  md)

Creates a reference-counted object to manage receiving messages from a MIDI device.

Definition at line 340 of file VuoMidi.cc.

◆ VuoMidiIn_receivedEvent()

void VuoMidiIn_receivedEvent ( double  timeStamp,
std::vector< unsigned char > *  message,
void *  userData 
)

RtMidi calls this function ("on a separate high-priority thread owned by CoreMIDI") every time it receives a MIDI event.

Definition at line 281 of file VuoMidi.cc.

◆ VuoMidiInputDevice_realize()

bool VuoMidiInputDevice_realize ( VuoMidiInputDevice  device,
VuoMidiInputDevice realizedDevice 
)

If device's ID or name is unknown:

  • If a matching device is present, sets realizedDevice to that device, and returns true.
  • If no matching device is present, returns false, leaving realizedDevice unset.

If device's ID and name are already known (presumably from the List MIDI Devices node), sets realizedDevice to a copy of device, and returns true. (Doesn't bother checking whether the device is currently present.)

This function may be called from any thread.

Definition at line 451 of file VuoMidi.cc.

◆ VuoMidiOut_destroy()

void VuoMidiOut_destroy ( VuoMidiOut  mo)

Destroys a MIDI output device manager.

Definition at line 255 of file VuoMidi.cc.

◆ VuoMidiOut_make()

VuoMidiOut VuoMidiOut_make ( VuoMidiOutputDevice  md)

Creates a reference-counted object to manage sending messages to a MIDI device.

Definition at line 176 of file VuoMidi.cc.

◆ VuoMidiOut_sendController()

void VuoMidiOut_sendController ( VuoMidiOut  mo,
VuoMidiController  controller 
)

Outputs the specified controller event through the specified MIDI output device mo.

Definition at line 223 of file VuoMidi.cc.

◆ VuoMidiOut_sendNote()

void VuoMidiOut_sendNote ( VuoMidiOut  mo,
VuoMidiNote  note 
)

Outputs the specified note event through the specified MIDI output device mo.

Definition at line 207 of file VuoMidi.cc.

◆ VuoMidiOut_sendPitchBend()

void VuoMidiOut_sendPitchBend ( VuoMidiOut  mo,
VuoMidiPitchBend  pitchBend 
)

Outputs the specified pitchBend event through the specified MIDI output device mo.

Definition at line 239 of file VuoMidi.cc.

◆ VuoMidiOutputDevice_realize()

bool VuoMidiOutputDevice_realize ( VuoMidiOutputDevice  device,
VuoMidiOutputDevice realizedDevice 
)

If device's ID or name unknown:

  • If a matching device is present, sets realizedDevice to that device, and returns true.
  • If no matching device is present, returns false, leaving realizedDevice unset.

If device's ID and name are already known (presumably from the List MIDI Devices node), sets realizedDevice to a copy of device, and returns true. (Doesn't bother checking whether the device is currently present.)

This function may be called from any thread.

Definition at line 522 of file VuoMidi.cc.

Variable Documentation

◆ VuoMidi_client

MIDIClientRef VuoMidi_client

Core MIDI client, for device notifications.

Definition at line 47 of file VuoMidi.cc.

◆ VuoMidi_inputDeviceCallbacks

VuoTriggerSet<VuoList_VuoMidiInputDevice> VuoMidi_inputDeviceCallbacks
static

Trigger functions to call when the list of midi input devices changes.

Definition at line 44 of file VuoMidi.cc.

◆ VuoMidi_outputDeviceCallbacks

VuoTriggerSet<VuoList_VuoMidiOutputDevice> VuoMidi_outputDeviceCallbacks
static

Trigger functions to call when the list of midi output devices changes.

Definition at line 45 of file VuoMidi.cc.

◆ VuoMidi_useCount

unsigned int VuoMidi_useCount = 0

Process-wide count of callers (typically node instances) interested in notifications about midi devices.

Definition at line 46 of file VuoMidi.cc.