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

◆ close_device()

void MayaFlux::Core::HIDBackend::close_device ( uint32_t  device_id)
overridevirtual

Close a previously opened device.

Parameters
device_idDevice identifier

Implements MayaFlux::Core::IInputBackend.

Definition at line 278 of file HIDBackend.cpp.

279{
280 std::lock_guard lock(m_devices_mutex);
281
282 auto it = m_open_devices.find(device_id);
283 if (it == m_open_devices.end()) {
284 return;
285 }
286
287 it->second->active.store(false);
288 if (it->second->handle) {
289 hid_close(it->second->handle);
290 }
291
293 "Closed HID device {}: {}", device_id, it->second->info.name);
294
295 m_open_devices.erase(it);
296}
#define MF_INFO(comp, ctx,...)
std::unordered_map< uint32_t, std::shared_ptr< HIDDeviceState > > m_open_devices
@ InputBackend
Input device backend (HID, MIDI, OSC)
@ Core
Core engine, backend, subsystems.

References MayaFlux::Journal::Core, MayaFlux::Journal::InputBackend, m_devices_mutex, m_open_devices, and MF_INFO.