MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ start()

void MayaFlux::Core::MIDIBackend::start ( )
overridevirtual

Start listening for input events.

Begins polling/callback registration for all opened devices. Input events will be delivered via registered callbacks.

Implements MayaFlux::Core::IInputBackend.

Definition at line 53 of file MIDIBackend.cpp.

54{
55 if (!m_initialized.load()) {
57 "Cannot start MIDIBackend: not initialized");
58 return;
59 }
60
61 if (m_running.load()) {
63 "MIDIBackend already running");
64 return;
65 }
66
67 std::vector<uint32_t> inputs_to_open;
68 {
69 std::lock_guard lock(m_devices_mutex);
70 for (const auto& [id, info] : m_enumerated_devices) {
71 if (info.is_input) {
72 inputs_to_open.push_back(id);
73 }
74 }
75 }
76
77 for (uint32_t id : inputs_to_open) {
78 open_device(id);
79 }
80
81 m_running.store(true);
82
84 "MIDIBackend started with {} open port(s)", get_open_devices().size());
85}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::unordered_map< uint32_t, MIDIPortInfo > m_enumerated_devices
std::atomic< bool > m_running
std::atomic< bool > m_initialized
std::vector< uint32_t > get_open_devices() const override
Get list of currently open device IDs.
bool open_device(uint32_t device_id) override
Open a device for input.
@ InputBackend
Input device backend (HID, MIDI, OSC)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, get_open_devices(), MayaFlux::Journal::InputBackend, m_devices_mutex, m_enumerated_devices, m_initialized, m_running, MF_ERROR, MF_INFO, MF_WARN, and open_device().

+ Here is the call graph for this function: