12 : m_scheduler(scheduler)
17 std::vector<std::reference_wrapper<BufferPipeline>> pipelines,
18 uint32_t sync_every_n_cycles,
19 uint64_t samples_per_cycle)
26 if (promise.should_terminate) {
30 if (cycle % sync_every_n_cycles == 0) {
31 for (
auto& pipeline_ref : pipelines) {
32 auto& pipeline = pipeline_ref.get();
33 if (pipeline.has_pending_data()) {
39 for (
auto& pipeline_ref : pipelines) {
40 pipeline_ref.get().execute_once();
49 std::vector<std::reference_wrapper<BufferPipeline>> pipelines,
50 uint32_t sync_every_n_cycles,
51 double seconds_per_cycle)
54 auto routine =
sync_pipelines(pipelines, sync_every_n_cycles, samples_per_cycle);
55 return std::make_shared<Vruta::SoundRoutine>(std::move(routine));
59 std::shared_ptr<Buffers::AudioBuffer> buffer,
60 std::function<
void(uint32_t)> on_data_ready,
61 std::function<
void(uint32_t)> on_data_expired)
68 if (promise.should_terminate) {
72 if (buffer->has_data_for_cycle()) {
76 if (buffer->has_data_for_cycle()) {
77 on_data_expired(cycle + 1);
#define MF_WARN(comp, ctx,...)
Vruta::SoundRoutine sync_pipelines(std::vector< std::reference_wrapper< BufferPipeline > > pipelines, uint32_t sync_every_n_cycles=1, uint64_t samples_per_cycle=1)
Create a synchronization routine for multiple pipelines.
Vruta::SoundRoutine manage_transient_data(std::shared_ptr< Buffers::AudioBuffer > buffer, std::function< void(uint32_t)> on_data_ready, std::function< void(uint32_t)> on_data_expired)
Create a transient data management routine.
CycleCoordinator(Vruta::TaskScheduler &scheduler)
Construct coordinator with task scheduler integration.
std::shared_ptr< Vruta::SoundRoutine > sync_pipelines_at_rate(std::vector< std::reference_wrapper< BufferPipeline > > pipelines, uint32_t sync_every_n_cycles, double seconds_per_cycle)
Create a synchronization routine based on real-time rate.
Vruta::TaskScheduler & m_scheduler
A C++20 coroutine-based audio processing task with sample-accurate timing.
uint64_t seconds_to_samples(double seconds) const
Converts a time in seconds to a number of samples.
Token-based multimodal task scheduling system for unified coroutine processing.
@ CoroutineScheduling
Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
@ Kriya
Automatable tasks and fluent scheduling api for Nodes and Buffers.
Templated awaitable for accessing a coroutine's promise object.
Awaitable object for precise sample-accurate timing delays.