Skip to main content

rill_patchbay/sequencer/
mod.rs

1//! # Parameter-lock step sequencer
2//!
3//! A sample-accurate, telemetry-driven sequencer for scheduling parameter
4//! changes over time.  Supports parameter-lock (p-lock) style programming:
5//! each step specifies exactly which parameters change and to what value;
6//! unlisted parameters are untouched.
7//!
8//! ## Concepts
9//!
10//! - [`ParameterTarget`] — a single (node, param, value) lock
11//! - [`SequenceStep`] — a set of p-locks + duration
12//! - [`Pattern`] — a sequence of steps with a playback mode
13//! - [`Snapshot`] — a named collection of p-locks (convenience presets)
14//! - [`SnapshotSequencer`] — tick-driven state machine
15//!
16//! ## Clock source
17//!
18//! The sequencer is designed to be driven by the audio thread's `CLOCK_TICK`
19//! telemetry events.  Each tick carries `(sample_pos, sample_rate, tempo)`,
20//! which the sequencer uses to determine step boundaries with sample accuracy.
21//!
22//! ## Integration
23//!
24//! Use [`PatchbayControl::attach_sequencer`](crate::control::PatchbayControl::attach_sequencer)
25//! or [`PatchbayEngine::attach_sequencer`](crate::engine::PatchbayEngine::attach_sequencer)
26//! to spawn the sequencer task and start listening for clock ticks.
27//! A [`SequencerHandle`] is returned for external control (start/stop/pattern
28//! select).
29
30mod snapshot;
31mod step;
32mod pattern;
33mod engine;
34
35pub use snapshot::{ParameterTarget, Snapshot};
36pub use step::SequenceStep;
37pub use pattern::{Pattern, StepPlayMode};
38pub use engine::{SequencerCommand, SequencerHandle, SnapshotSequencer};
39
40/// Serializable sequencer configuration (serde feature gate).
41#[cfg(feature = "serde")]
42mod document;
43#[cfg(feature = "serde")]
44pub use document::SequencerDocument;