pub struct Session {
pub bpm: u32,
pub sig: (u8, u8),
pub phrase: u32,
pub seed: u64,
pub scale: Option<(PitchRoot, ScaleMode)>,
/* private fields */
}Expand description
Live session state.
Fields§
§bpm: u32Current BPM.
sig: (u8, u8)Current time signature (numerator, denominator).
phrase: u32How many cycles a phrase spans. Changes are quantised to it, so 1 is
“apply at the next cycle” and 16 is “apply at the top of the phrase”.
seed: u64seed (§8.8) — salts every generative construct in the buffer.
scale: Option<(PitchRoot, ScaleMode)>Default scale for degree patterns (scale directive).
Implementations§
Source§impl Session
impl Session
pub fn new() -> Self
Sourcepub fn piece(&self) -> Option<&Piece>
pub fn piece(&self) -> Option<&Piece>
The resolved piece, when the buffer has sections (§8).
This is the authoritative structure in piece mode: Session::patterns
still holds the union of every section’s lines, but only so a consumer
can see which instruments the buffer needs — which line sounds when is
the piece’s business, since the same name legitimately appears in every
section.
Sourcepub fn is_piece(&self) -> bool
pub fn is_piece(&self) -> bool
Whether the buffer is a piece rather than a live session (§8.1).
Sourcepub fn evaluate(&mut self, source: &str) -> EvalResult
pub fn evaluate(&mut self, source: &str) -> EvalResult
Evaluate a source string, parse it, diff against previous state, and return the result.
Sourcepub fn definitions(&self) -> &HashMap<String, InstrumentDef>
pub fn definitions(&self) -> &HashMap<String, InstrumentDef>
Instruments defined in the buffer, by name.
Sourcepub fn pending_deltas(&self) -> &[Delta]
pub fn pending_deltas(&self) -> &[Delta]
Get the currently pending deltas.
Sourcepub fn apply_pending(&mut self)
pub fn apply_pending(&mut self)
Apply pending deltas (called by the TUI at loop boundary).
Sourcepub fn active_patterns(&self) -> Vec<&PatternDef>
pub fn active_patterns(&self) -> Vec<&PatternDef>
Get the current active (non-muted) pattern definitions.
Sourcepub fn all_patterns(&self) -> &HashMap<String, PatternDef>
pub fn all_patterns(&self) -> &HashMap<String, PatternDef>
Get all pattern definitions (including muted).