MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Buffers::TokenUnitManager Class Reference

Token-scoped unit storage and lifecycle management. More...

#include <TokenUnitManager.hpp>

+ Collaboration diagram for MayaFlux::Buffers::TokenUnitManager:

Public Member Functions

 TokenUnitManager (ProcessingToken default_token, uint32_t default_out_channels, uint32_t default_buffer_size)
 Creates a new unit manager with initial audio unit configuration.
 
 TokenUnitManager (ProcessingToken default_audio_token=ProcessingToken::AUDIO_BACKEND, ProcessingToken default_graphics_token=ProcessingToken::GRAPHICS_BACKEND)
 
 ~TokenUnitManager ()=default
 
RootAudioUnitget_or_create_audio_unit (ProcessingToken token)
 Gets or creates a root audio unit for the specified token.
 
const RootAudioUnitget_audio_unit (ProcessingToken token) const
 Gets an existing audio unit without creating if missing.
 
RootAudioUnitget_audio_unit_mutable (ProcessingToken token)
 Gets an existing audio unit without creating if missing (mutable)
 
RootAudioUnitensure_and_get_audio_unit (ProcessingToken token, uint32_t channel)
 Ensures a root audio unit exists for a specific token and channel.
 
bool has_audio_unit (ProcessingToken token) const
 Checks if an audio unit exists for the given token.
 
std::vector< ProcessingTokenget_active_audio_tokens () const
 Gets all active audio processing tokens.
 
RootGraphicsUnitget_or_create_graphics_unit (ProcessingToken token)
 Gets or creates a root graphics unit for the specified token.
 
const RootGraphicsUnitget_graphics_unit (ProcessingToken token) const
 Gets an existing graphics unit without creating if missing.
 
RootGraphicsUnitget_graphics_unit_mutable (ProcessingToken token)
 Gets an existing graphics unit without creating if missing (mutable)
 
bool has_graphics_unit (ProcessingToken token) const
 Checks if a graphics unit exists for the given token.
 
std::vector< ProcessingTokenget_active_graphics_tokens () const
 Gets all active graphics processing tokens.
 
void ensure_audio_channels (ProcessingToken token, uint32_t channel_count)
 Ensures an audio unit exists and resizes it to the specified channel count.
 
void resize_audio_buffers (ProcessingToken token, uint32_t buffer_size)
 Resizes all buffers in an audio unit to the specified size.
 
uint32_t get_audio_channel_count (ProcessingToken token) const
 Gets the number of channels in an audio unit.
 
uint32_t get_audio_buffer_size (ProcessingToken token) const
 Gets the buffer size for an audio unit.
 
void validate_num_audio_channels (ProcessingToken token, uint32_t num_channels, uint32_t buffer_size)
 Validates the number of channels and resizes buffers if necessary.
 
ProcessingToken get_default_audio_token () const
 Gets the default processing token.
 
ProcessingToken get_default_graphics_token () const
 Gets the default graphics processing token.
 
std::mutex & get_mutex () const
 Acquires the manager's mutex for external synchronization.
 

Private Attributes

ProcessingToken m_default_audio_token
 Default processing token for legacy compatibility and initialization.
 
ProcessingToken m_default_graphics_token
 Default graphics processing token.
 
std::unordered_map< ProcessingToken, RootAudioUnitm_audio_units
 Token-based map of root audio buffer units Maps: ProcessingToken -> channel -> {root_buffers, processing chains}.
 
std::unordered_map< ProcessingToken, RootGraphicsUnitm_graphics_units
 Token-based map of root graphics buffer units.
 
std::mutex m_manager_mutex
 Mutex for thread-safe access to all unit maps.
 

Detailed Description

Token-scoped unit storage and lifecycle management.

Manages the core data structures for both audio and graphics units, providing thread-safe, token-aware access patterns. This class is the single source of truth for unit lifecycle and storage.

Design Principles:

  • Token-generic: Doesn't distinguish between audio/graphics at the data level
  • Thread-safe: All modifications guarded by mutex
  • Lazy creation: Units created on-demand via get_or_create patterns
  • Immutable queries: Const queries never create units

Definition at line 68 of file TokenUnitManager.hpp.


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