Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

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.

Documentation