Skip to main content

Performance

Struct Performance 

Source
pub struct Performance { /* private fields */ }
Expand description

A running program — see the module docs.

Implementations§

Source§

impl Performance

Source

pub fn new(program: Arc<Program>) -> Self

Load a compiled program, stopped at frame 0. The engine’s sample rate is the program’s.

Source

pub fn program(&self) -> &Arc<Program>

The running program.

Source

pub fn transport(&self) -> &Transport

The transport (position, loops — seek helpers are also commands).

Source

pub fn master_gain(&self) -> f32

The current master gain.

Source

pub fn metrics(&self) -> PerformanceMetrics

A health snapshot (queue depth is sampled at call time).

Source

pub fn queue_depth(&self) -> usize

The current queue depth.

Source

pub fn clock(&self) -> u64

The command clock (frames rendered).

Source

pub fn schedule( &mut self, command: Command, at: At, ) -> Result<u64, PerformanceError>

Schedule a command at at. Musical positions resolve to exact frames now; identical frames execute in submission order. A full queue rejects the command (counted in the metrics).

Source

pub fn stinger( &mut self, doc: &SoundDoc, gain: f32, at: At, ) -> Result<u64, PerformanceError>

Schedule a stinger: render the doc NOW — the fire inside fill then only mixes a pre-rendered buffer, so the render path never renders or allocates at fire time — and fire it at at with gain.

Source

pub fn swap_to( &mut self, program: Arc<Program>, at: At, ) -> Result<u64, PerformanceError>

Schedule a program swap (crossfaded at at). The target must load clean — a rejected target changes nothing (the last valid program keeps running).

Source

pub fn transition_to_section( &mut self, name: &str, at: At, ) -> Result<u64, PerformanceError>

A quantized section transition: seek to the section’s first bar at the next bar line (or immediately with At::Immediate). The latest transition wins: scheduling one while another is pending drops the older pending seek (defined interruption behavior). An unknown section is rejected now — never a silent no-op later.

Source

pub fn start_capture(&mut self)

Start recording scheduled commands for deterministic replay.

Source

pub fn stop_capture(&mut self) -> Vec<TimestampedCommand>

Stop recording and take the captured commands.

Source

pub fn replay(&mut self, commands: &[TimestampedCommand])

Replay captured commands at their recorded frames, in order.

Source

pub fn snapshot(&self) -> PerformanceSnapshot

A state snapshot: transport position/state, master gain, loop range. Applying it returns the performance to this exact control state.

Source

pub fn apply_snapshot(&mut self, snapshot: &PerformanceSnapshot)

Restore a snapshot (deterministic: the song source re-seeks).

Trait Implementations§

Source§

impl AudioSource for Performance

Source§

fn fill(&mut self, out: &mut [f32]) -> usize

Render interleaved stereo, executing due commands at their exact frames (submission order on ties) — the block is split at command boundaries so a command never lands early or late.

Source§

fn reset(&mut self)

Rewind the source to its start (playback position / phase to zero). Defaults to a no-op; a looping source overrides it so a transport can restart it from the top. AdaptiveMusic::reset calls this on each layer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more