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

◆ stop()

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

Stop listening for input events.

Pauses input delivery without closing devices.

Implements MayaFlux::Core::IInputBackend.

Definition at line 87 of file MIDIBackend.cpp.

88{
89 if (!m_running.load()) {
90 return;
91 }
92
93 {
94 std::lock_guard lock(m_devices_mutex);
95 for (auto& [id, state] : m_open_devices) {
96 state->active.store(false);
97 if (state->midi_in) {
98 try {
99 state->midi_in->closePort();
100 } catch (const RtMidiError& error) {
102 "Error closing MIDI port {}: {}", state->info.name, error.getMessage());
103 }
104 }
105 }
106 }
107
108 m_running.store(false);
109
111 "MIDIBackend stopped");
112}
#define MF_INFO(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
std::atomic< bool > m_running
std::unordered_map< uint32_t, std::shared_ptr< MIDIPortState > > m_open_devices
@ 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, MayaFlux::Journal::InputBackend, m_devices_mutex, m_open_devices, m_running, MF_INFO, and MF_WARN.

Referenced by shutdown().

+ Here is the caller graph for this function: