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

◆ initialize()

bool MayaFlux::Core::MIDIBackend::initialize ( )
overridevirtual

Initialize the input backend.

Returns
true if initialization succeeded

Should discover available devices but not start polling/listening.

Implements MayaFlux::Core::IInputBackend.

Definition at line 25 of file MIDIBackend.cpp.

26{
27 if (m_initialized.load()) {
29 "MIDIBackend already initialized");
30 return true;
31 }
32
33 try {
35 "Initializing MIDI Backend (RtMidi version: {})", get_version());
36
37 m_initialized.store(true);
40
42 "MIDIBackend initialized with {} port(s)", m_enumerated_devices.size());
43
44 return true;
45
46 } catch (const RtMidiError& error) {
48 "RtMidi error during initialization: {}", error.getMessage());
49 return false;
50 }
51}
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::string get_version() const override
Get backend version string.
std::unordered_map< uint32_t, MIDIPortInfo > m_enumerated_devices
size_t refresh_devices() override
Refresh the device list.
std::atomic< bool > m_initialized
@ InputBackend
Input device backend (HID, MIDI, OSC)
void error(Component component, Context context, std::source_location location, std::string_view message)
Log an error message and optionally throw an exception.
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, create_virtual_port_if_enabled(), get_version(), MayaFlux::Journal::InputBackend, m_enumerated_devices, m_initialized, MF_ERROR, MF_INFO, MF_WARN, and refresh_devices().

+ Here is the call graph for this function: