279{
280 try {
281 uint32_t read_length = length;
282 if (read_length == 0) {
283 read_length = static_cast<uint32_t>(container->get_total_elements() / container->get_num_channels());
284 }
285
286 std::vector<double> output_data(static_cast<size_t>(read_length * container->get_num_channels()));
287 std::span<double> output_span(output_data.data(), output_data.size());
288
289 uint64_t frames_read = container->read_frames(output_span, read_length);
290
291 if (frames_read < output_data.size()) {
292 output_data.resize(frames_read);
293 }
294
295 return output_data;
296
297 } catch (const std::exception& e) {
300 std::source_location::current(),
301 "Error reading from container: {}",
302 e.what());
303
304 return std::vector<double> {};
305 }
306}
@ 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.