228{
229 auto audio_buffer = std::dynamic_pointer_cast<Buffers::AudioBuffer>(buffer);
230 if (audio_buffer) {
231 try {
232 auto audio_data = std::get<std::vector<double>>(data);
233 auto& buffer_data = audio_buffer->get_data();
234
235 if (buffer_data.size() != audio_data.size()) {
236 buffer_data.resize(audio_data.size());
237 }
238
239 std::ranges::copy(audio_data, buffer_data.begin());
240
241 } catch (const std::bad_variant_access& e) {
244 std::source_location::current(),
245 "Data type mismatch when writing to audio buffer: {}",
246 e.what());
247 }
248 }
249
250
251}
@ 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.