Skip to main content

Program

Struct Program 

Source
pub struct Program<'code, const OPS: usize, const PORTS: usize = 8> { /* private fields */ }
Expand description

A decoded, feed-forward block schedule. It can be prepared while another program plays. OPS bounds the stored instructions. PORTS bounds the signal inlets and outlets per object independently.

Implementations§

Source§

impl<'code, const OPS: usize, const PORTS: usize> Program<'code, OPS, PORTS>

Source

pub fn decode(code: &'code [u8]) -> Result<Self, Error>

Decode the wire format and validate its routing and resource bounds.

§Errors

Returns an error for invalid bytecode or exceeded capacities. Wire indices address up to 256 objects and 256 signal buses.

Source

pub fn buses(&self) -> usize

Number of mono block buffers required by this program.

Source

pub fn bind<'run, 'node, M, S>( &'run self, objects: &'run mut [&'node mut dyn Process<M, S>], ) -> Result<Patch<'run, 'node, M, S, PORTS>, Error>

Bind application-owned processor instances to the program’s object indices.

§Errors

Returns Error::Object for missing instances and Error::Ports for signal layouts that disagree with the bytecode.

Source

pub fn bind_nodes<'run, 'node, M, S, P: Process<M, S> + ?Sized>( &'run self, objects: &'run mut [&'node mut P], ) -> Result<Patch<'run, 'node, M, S, PORTS, P>, Error>

Bind nodes while retaining their concrete type or trait-object bounds. For example, a table of dyn Process<M, S> + Send produces a Send patch that can be handed to an audio task.

§Errors

Returns the same object and port errors as Self::bind.

Trait Implementations§

Source§

impl<'code, const OPS: usize, const PORTS: usize> Debug for Program<'code, OPS, PORTS>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'code, const OPS: usize, const PORTS: usize> Forget for Program<'code, OPS, PORTS>

§

impl<'code, const OPS: usize, const PORTS: usize> Freeze for Program<'code, OPS, PORTS>
where PhantomData<Op<'code>>: Freeze, &'code [u8]: Freeze,

§

impl<'code, const OPS: usize, const PORTS: usize> Move for Program<'code, OPS, PORTS>

§

impl<'code, const OPS: usize, const PORTS: usize> RefUnwindSafe for Program<'code, OPS, PORTS>

§

impl<'code, const OPS: usize, const PORTS: usize> Send for Program<'code, OPS, PORTS>
where &'code [u8]: Send,

§

impl<'code, const OPS: usize, const PORTS: usize> Sync for Program<'code, OPS, PORTS>

§

impl<'code, const OPS: usize, const PORTS: usize> Unpin for Program<'code, OPS, PORTS>
where &'code [u8]: Unpin,

§

impl<'code, const OPS: usize, const PORTS: usize> UnsafeUnpin for Program<'code, OPS, PORTS>
where PhantomData<Op<'code>>: UnsafeUnpin, &'code [u8]: UnsafeUnpin,

§

impl<'code, const OPS: usize, const PORTS: usize> UnwindSafe for Program<'code, OPS, PORTS>
where &'code [u8]: UnwindSafe,

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<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

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> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.