MayaFlux 0.1.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 14 of file CycleCoordinator.cpp.

18{
19
20 auto& promise = co_await GetAudioPromise {};
21 uint32_t cycle = 0;
22
23 while (true) {
24 if (promise.should_terminate) {
25 break;
26 }
27
28 if (cycle % sync_every_n_cycles == 0) {
29 for (auto& pipeline_ref : pipelines) {
30 auto& pipeline = pipeline_ref.get();
31 if (pipeline.has_pending_data()) {
32 std::cout << "Sync point: Pipeline has stale data at cycle " << cycle << '\n';
33 }
34 }
35 }
36
37 for (auto& pipeline_ref : pipelines) {
38 pipeline_ref.get().execute_once();
39 }
40
41 ++cycle;
42 co_await SampleDelay { samples_per_cycle };
43 }
44}
GetPromiseBase< Vruta::audio_promise > GetAudioPromise
Audio domain promise accessor.
Definition Awaiters.hpp:231

Referenced by sync_pipelines_at_rate().

+ Here is the caller graph for this function: