266{
267 try {
268 uint32_t read_length = length;
269 if (read_length == 0) {
270 read_length = static_cast<uint32_t>(container->get_total_elements() / container->get_num_channels());
271 }
272
273 std::vector<double> output_data(static_cast<size_t>(read_length * container->get_num_channels()));
274 std::span<double> output_span(output_data.data(), output_data.size());
275
276 uint64_t frames_read = container->read_frames(output_span, read_length);
277
278 if (frames_read < output_data.size()) {
279 output_data.resize(frames_read);
280 }
281
282 return output_data;
283
284 } catch (const std::exception& e) {
287 std::source_location::current(),
288 "Error reading from container: {}",
289 e.what());
290
291 return std::vector<double> {};
292 }
293}
@ 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.