MayaFlux 0.1.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 214 of file BufferPipeline.cpp.

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

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

Referenced by capture_operation(), and process_operation().

+ Here is the caller graph for this function: