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

◆ write_to_buffer()

void MayaFlux::Kriya::BufferPipeline::write_to_buffer ( const std::shared_ptr< Buffers::AudioBuffer > &  buffer,
const Kakshya::DataVariant data 
)
staticprivate

Definition at line 227 of file BufferPipeline.cpp.

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 // TODO: Handle other buffer types
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.

References MayaFlux::Journal::CoroutineScheduling, and MayaFlux::Journal::Kriya.

Referenced by process_operation().

+ Here is the caller graph for this function: