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

◆ fill_audio_interleaved()

void MayaFlux::Buffers::BufferSupplyMixing::fill_audio_interleaved ( double *  interleaved_data,
uint32_t  num_frames,
ProcessingToken  token,
uint32_t  num_channels 
) const

Fills interleaved buffer from audio token channels.

Parameters
interleaved_dataTarget interleaved data buffer
num_framesNumber of frames to process
tokenProcessing domain
num_channelsNumber of channels to interleave

Takes channel-separated data from the token and interleaves it into a single buffer (like typical audio file format or hardware I/O).

Definition at line 118 of file BufferSupplyMixing.cpp.

123{
125 return;
126 }
127
128 const auto& unit = m_unit_manager.get_audio_unit(token);
129 uint32_t channels_to_process = std::min(num_channels, unit.channel_count);
130
131 for (uint32_t channel = 0; channel < channels_to_process; ++channel) {
132 const auto& buffer_data = unit.get_buffer(channel)->get_data();
133 uint32_t frames_to_copy = std::min(num_frames, static_cast<uint32_t>(buffer_data.size()));
134
135 for (uint32_t frame = 0; frame < frames_to_copy; ++frame) {
136 interleaved_data[frame * num_channels + channel] = buffer_data[frame];
137 }
138 }
139}
static MayaFlux::Nodes::ProcessingToken token
Definition Timers.cpp:8
TokenUnitManager & m_unit_manager
Reference to the token/unit manager.
const RootAudioUnit & get_audio_unit(ProcessingToken token) const
Gets an existing audio unit without creating if missing.
bool has_audio_unit(ProcessingToken token) const
Checks if an audio unit exists for the given token.

References MayaFlux::Buffers::TokenUnitManager::get_audio_unit(), MayaFlux::Buffers::TokenUnitManager::has_audio_unit(), m_unit_manager, and token.

+ Here is the call graph for this function: