MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Core::InputManager Class Reference

Manages input processing thread and node dispatch. More...

#include <InputManager.hpp>

+ Collaboration diagram for MayaFlux::Core::InputManager:

Classes

struct  NodeRegistration
 

Public Member Functions

void enqueue (const InputValue &value)
 Enqueue an input value for processing.
 
void enqueue_batch (const std::vector< InputValue > &values)
 Enqueue multiple input values.
 
uint64_t get_events_processed () const
 Get number of events processed since start.
 
size_t get_queue_depth () const
 Get current queue depth.
 
size_t get_registered_node_count () const
 Get count of registered nodes.
 
 InputManager ()
 
 InputManager (const InputManager &)=delete
 
 InputManager (InputManager &&)=delete
 
bool is_running () const
 Check if processing thread is running.
 
InputManageroperator= (const InputManager &)=delete
 
InputManageroperator= (InputManager &&)=delete
 
void register_node (const std::shared_ptr< Nodes::Input::InputNode > &node, InputBinding binding)
 Register a node to receive input.
 
void setup_osc_bridge (const OSCConfigInfo &osc_config)
 Setup OSC bridge if enabled in config.
 
void start ()
 Start the processing thread.
 
void stop ()
 Stop the processing thread.
 
void unregister_all_nodes ()
 Unregister all nodes.
 
void unregister_node (const std::shared_ptr< Nodes::Input::InputNode > &node)
 Unregister a node.
 
 ~InputManager ()
 

Private Types

using RegistrationList = std::vector< NodeRegistration >
 

Private Member Functions

void dispatch_to_nodes (const InputValue &value)
 
bool matches_binding (const InputValue &value, const InputBinding &binding) const
 
void processing_loop ()
 
std::optional< InputBindingresolve_vid_pid (const InputBinding &binding, const std::vector< InputDeviceInfo > &devices) const
 
void teardown_osc_bridge ()
 

Private Attributes

std::atomic< uint64_t > m_events_processed { 0 }
 
Registry::Service::InputServicem_input_service { nullptr }
 
Registry::Service::NetworkServicem_network_service { nullptr }
 
uint64_t m_osc_endpoint_id { 0 }
 
std::thread m_processing_thread
 
Memory::LockFreeQueue< InputValue, MAX_QUEUE_SIZEm_queue
 
std::atomic< bool > m_queue_notify { false }
 
std::atomic< std::shared_ptr< const RegistrationList > > m_registrations
 
std::mutex m_registry_mutex
 
std::atomic< bool > m_running { false }
 
std::atomic< bool > m_stop_requested { false }
 
std::vector< std::shared_ptr< Nodes::Input::InputNode > > m_tracked_nodes
 To keep nodes alive.
 

Static Private Attributes

static constexpr size_t MAX_QUEUE_SIZE = 4096
 

Detailed Description

Manages input processing thread and node dispatch.

InputManager is the core processing entity for input. It:

  • Owns the input processing thread
  • Maintains device→node routing table
  • Receives InputValues from backends via thread-safe queue
  • Dispatches input to registered nodes by calling process_input()

Threading model:

  • Backends push to queue from their threads (thread-safe)
  • Single processing thread dispatches to nodes
  • Node callbacks fire on the processing thread

Owned by InputSubsystem, which handles lifecycle coordination.

Definition at line 34 of file InputManager.hpp.


The documentation for this class was generated from the following files: