|
Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
|
Abstraction for hardware MIDI interface. More...
#include <src/dsp/hardware_midi_interface.h>

Public Types | |
| using | BufferMap |
| using | DeviceChangeCallback = std::function<void ()> |
Public Member Functions | |
| virtual void | set_device_change_callback (std::optional< DeviceChangeCallback > cb)=0 |
| Registers a notification-only device change callback. | |
| virtual BufferMap | device_buffers () const =0 |
| Returns the current map of device identifiers to buffers. | |
Abstraction for hardware MIDI interface.
Decouples the audio engine from specific MIDI backend implementations (JUCE AudioDeviceManager, raw ALSA, CoreMIDI, etc.).
The engine registers a notification callback via set_device_change_callback() and pulls the current buffer state via device_buffers().
All methods and the callback are main-thread-only.
Definition at line 27 of file hardware_midi_interface.h.
| using zrythm::dsp::IHardwareMidiInterface::BufferMap |
Definition at line 30 of file hardware_midi_interface.h.
| using zrythm::dsp::IHardwareMidiInterface::DeviceChangeCallback = std::function<void ()> |
Definition at line 32 of file hardware_midi_interface.h.
|
pure virtual |
Returns the current map of device identifiers to buffers.
The returned shared_ptrs remain valid as long as the caller holds them, even across device changes (buffers are only destroyed when no longer referenced).
Implemented in zrythm::gui::backend::DeviceManager, and zrythm::test_helpers::MockHardwareMidiInterface.
|
pure virtual |
Registers a notification-only device change callback.
The implementation must call cb on the main thread whenever the set of active MIDI devices changes. The callback carries no data — the listener should call device_buffers() to pull the current state.
Passing nullopt unregisters the callback. Only one callback is supported. Calling again replaces the previous one.
Implemented in zrythm::gui::backend::DeviceManager, and zrythm::test_helpers::MockHardwareMidiInterface.