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

◆ get_or_create_audio_unit()

RootAudioUnit & MayaFlux::Buffers::TokenUnitManager::get_or_create_audio_unit ( ProcessingToken  token)

Gets or creates a root audio unit for the specified token.

Parameters
tokenProcessing domain
Returns
Reference to the root audio unit

If the unit doesn't exist, creates it and returns it. Thread-safe creation via lock guard.

Definition at line 71 of file TokenUnitManager.cpp.

72{
73 auto it = m_audio_units.find(token);
74 if (it == m_audio_units.end()) {
75 std::lock_guard<std::mutex> lock(m_manager_mutex);
76 auto [inserted_it, success] = m_audio_units.emplace(token, RootAudioUnit {});
77 return inserted_it->second;
78 }
79 return it->second;
80}
static MayaFlux::Nodes::ProcessingToken token
Definition Timers.cpp:8
std::mutex m_manager_mutex
Mutex for thread-safe access to all unit maps.
std::unordered_map< ProcessingToken, RootAudioUnit > m_audio_units
Token-based map of root audio buffer units Maps: ProcessingToken -> channel -> {root_buffers,...

References m_audio_units, m_manager_mutex, and token.

Referenced by MayaFlux::Buffers::BufferAccessControl::add_audio_buffer(), MayaFlux::Buffers::BufferProcessingControl::add_audio_processor_to_token(), ensure_and_get_audio_unit(), ensure_audio_channels(), MayaFlux::Buffers::BufferAccessControl::get_audio_processing_chain(), MayaFlux::Buffers::BufferAccessControl::get_root_audio_buffer(), and resize_audio_buffers().

+ Here is the caller graph for this function: