Karya, built on 2022-03-21T01:30:44 (patch 89d1651424c35e564138d93424a157ff87457245)

Midi.CoreMidi

Description

Interface to CoreMIDI.

Receiving messages in CoreMIDI is simple, there's a callback that gets called when one arrives. However, it identifies them with a DeviceId, not a name. You get the ID when you open the device for reading. If the device is not present, then I record that I want it in Client, and notify_callback will hopefully add the DeviceId if it does appear.

Sending messages is the same situation. It's more complicated at the C level, which is documented in core_midi.cc.

Other than that, CoreMIDI is pretty straightforward. Since I only support a single MIDI initialization, the various open client and port types are kept as global variables inside the C binding.

I originally tried to use PortMidi, but found it both lacking essential features (it couldn't schedule MIDI both for the future and for now), but also harder to write for.