Cleans up completed routing transitions.
Removes buffers from old channels and finalizes registration to new channels after fade completion.
270{
272 return;
273 }
274
276
277 std::vector<std::tuple<std::shared_ptr<AudioBuffer>, uint32_t, uint32_t>> buffers_to_move;
278
279 for (uint32_t channel = 0; channel < unit.channel_count; ++channel) {
281
282 for (auto& child : root_buffer->get_child_buffers()) {
283 if (!child->needs_routing()) {
284 continue;
285 }
286
287 auto& state = child->get_routing_state();
288
290 buffers_to_move.emplace_back(child, state.from_channel, state.to_channel);
291 }
292 }
293 }
294
295 for (auto& [buffer, from_ch, to_ch] : buffers_to_move) {
296 auto root_from = unit.get_buffer(from_ch);
297 auto root_to = unit.get_buffer(to_ch);
298
299 root_from->remove_child_buffer(buffer);
300
301 buffer->set_channel_id(to_ch);
302 root_to->add_child_buffer(buffer);
303
305
306 buffer->get_routing_state() = BufferRoutingState {};
307 }
308}
bool remove_supplied_audio_buffer(const std::shared_ptr< AudioBuffer > &buffer, ProcessingToken token, uint32_t channel)
Removes a previously supplied buffer from a token and channel.
TokenUnitManager & m_unit_manager
Reference to the token/unit manager.
bool has_audio_unit(ProcessingToken token) const
Checks if an audio unit exists for the given token.
RootAudioUnit & get_audio_unit_mutable(ProcessingToken token)
Gets an existing audio unit without creating if missing (mutable)
std::shared_ptr< RootAudioBuffer > get_buffer(uint32_t channel) const