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

◆ sync_pipelines()

Vruta::SoundRoutine MayaFlux::Kriya::CycleCoordinator::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.

Parameters
pipelinesVector of pipeline references to synchronize
sync_every_n_cyclesSynchronization interval in cycles
samples_per_cycleNumber of samples per cycle for timing
Returns
SoundRoutine that manages pipeline synchronization

Definition at line 16 of file CycleCoordinator.cpp.

20{
21
22 auto& promise = co_await GetAudioPromise {};
23 uint32_t cycle = 0;
24
25 while (true) {
26 if (promise.should_terminate) {
27 break;
28 }
29
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()) {
34 MF_WARN(Journal::Component::Kriya, Journal::Context::CoroutineScheduling, "Sync point: Pipeline has stale data at cycle {}", cycle);
35 }
36 }
37 }
38
39 for (auto& pipeline_ref : pipelines) {
40 pipeline_ref.get().execute_once();
41 }
42
43 ++cycle;
44 co_await SampleDelay { samples_per_cycle };
45 }
46}
#define MF_WARN(comp, ctx,...)
@ CoroutineScheduling
Coroutine scheduling and temporal coordination (Vruta::TaskScheduler)
@ Kriya
Automatable tasks and fluent scheduling api for Nodes and Buffers.
GetPromiseBase< Vruta::audio_promise > GetAudioPromise
Audio domain promise accessor.

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

Referenced by sync_pipelines_at_rate().

+ Here is the caller graph for this function: