215{
216 auto audio_buffer = std::dynamic_pointer_cast<Buffers::AudioBuffer>(buffer);
217 if (audio_buffer) {
218 try {
219 auto audio_data = std::get<std::vector<double>>(data);
220 auto& buffer_data = audio_buffer->get_data();
221
222 if (buffer_data.size() != audio_data.size()) {
223 buffer_data.resize(audio_data.size());
224 }
225
226 std::ranges::copy(audio_data, buffer_data.begin());
227
228 } catch (const std::bad_variant_access& e) {
231 std::source_location::current(),
232 "Data type mismatch when writing to audio buffer: {}",
233 e.what());
234 }
235 }
236
237
238}
@ CoroutineScheduling
Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Kriya
Automatable tasks and fluent scheduling api for Nodes and Buffers.