Skip to main content

Program

Struct Program 

Source
pub struct Program {
    pub program_version: u32,
    pub schema_version: u32,
    pub engine_version: u32,
    pub hash: u64,
    pub target: CompileTarget,
    pub doc: SoundDoc,
    pub meta: ProgramMeta,
    pub estimates: ResourceEstimates,
    pub warnings: Vec<Diagnostic>,
}
Expand description

A compiled song: validated, resolved, hashed. Built by Song::compile; reloaded by Program::from_json.

Fields§

§program_version: u32

The bundle revision (see PROGRAM_VERSION).

§schema_version: u32

The resolved document’s effective schema version.

§engine_version: u32

The resolved document’s effective engine revision.

§hash: u64

Canonical semantic hash. Version 1 covers the document; version 2 covers every serialized semantic field except this hash.

§target: CompileTarget

The target this program was compiled for (offline or runtime).

§doc: SoundDoc

The resolved document — renders through the exact same engine as everything else; nothing new in the render path.

§meta: ProgramMeta

The musical metadata a transport (or a host deciding how far ahead to schedule) needs — preserved at compile time, not reconstructed.

§estimates: ResourceEstimates

Bounded resource estimates the runtime preallocates from (ADR 0005).

§warnings: Vec<Diagnostic>

Offline compile warnings: streaming blockers re-derived from the resolved document on load (a pure function of it), never stored. Runtime-target compilation rejects these blockers instead.

Implementations§

Source§

impl Program

Source

pub fn render_mono(&self) -> Vec<f32>

Render the full program to mono samples through the standard engine.

Source

pub fn render_stereo(&self) -> (Vec<f32>, Vec<f32>)

Render the full program to a stereo pair. A compiled song always has a stereo mix; a defensively duplicated mono pair is returned if it somehow doesn’t.

Source

pub fn render_range_frames(&self, start: u64, end: u64) -> (Vec<f32>, Vec<f32>)

Render a frame range [start, end) as a stereo pair — a slice of the full render, so a note or tail crossing the range boundary sounds exactly as it does in the full mix (this is why ranges render through, not from, the boundary). Out-of-range requests clamp.

Source

pub fn render_range_bars( &self, start_bar: u32, end_bar: u32, ) -> (Vec<f32>, Vec<f32>)

Render a bar range [start_bar, end_bar) through the program’s meter map (see Self::render_range_frames).

Source

pub fn render_stems(&self) -> Vec<Stem>

Render per-track and per-bus stereo stems (pre-master-chain — see render::Stem): every track stem plus every bus stem, in declaration order. Muted tracks are silent stems.

Source

pub fn is_streamable(&self) -> bool

Whether the resolved document streams natively (no warnings is the same signal — blockers are the only warnings compilation produces).

Source

pub fn capabilities(&self) -> Vec<&'static str>

The machine-readable capability list: what this program can do on a host — "offline-render" and "stems" always; "streaming" when the resolved document streams natively. Derived from the warnings (a pure function of the document), so it’s identical from any loader.

Source

pub fn to_json(&self) -> String

Serialize the bundle (compact JSON; stable field order from the struct).

Source

pub fn from_json(json: &str) -> Result<Program, ProgramError>

Load a bundle: parse, reject a newer revision (T3001), re-verify the semantic hash (T3002), and re-derive the warnings from the resolved document. No musical recomputation — loading never recompiles.

Trait Implementations§

Source§

impl Clone for Program

Source§

fn clone(&self) -> Program

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Program

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Program

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Program

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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