Skip to main content

Op

Enum Op 

Source
pub enum Op<'a> {
    Call {
        object: u8,
        inputs: &'a [u8],
        outputs: u8,
    },
    Gain {
        input: u8,
        level: u8,
    },
    Mix {
        left: u8,
        right: u8,
    },
}
Expand description

A block-level signal graph instruction. Object IDs refer to stateful native instances installed by the application. A decoded call borrows its input bus indices directly from the bytecode.

Variants§

§

Call

Run a patch object once on the current audio block.

Fields

§object: u8

Index in the patch’s object table.

§inputs: &'a [u8]

One source bus per signal inlet, in inlet order.

§outputs: u8

Number of consecutive buses produced, in signal outlet order.

§

Gain

Scale one input bus and append the saturated result.

Fields

§input: u8

Source bus.

§level: u8

Gain in units of 1/128. A value of 128 is unity.

§

Mix

Append the saturating sum of two input buses.

Fields

§left: u8

First source bus.

§right: u8

Second source bus.

Implementations§

Source§

impl<'a> Op<'a>

Source

pub fn decode(bytes: &'a [u8]) -> Result<(Op<'a>, &'a [u8]), DecodeError>

Decode the first instruction and return the unconsumed suffix.

§Errors

Returns DecodeError for an incomplete or unrecognized instruction.

Source

pub fn encode(self, output: &mut [u8]) -> Result<usize, EncodeError>

Write one complete instruction and return the number of bytes written. The program’s leading version byte is supplied by the caller.

§Errors

Returns EncodeError before writing anything if the instruction cannot be represented or the output buffer is too short.

Trait Implementations§

Source§

impl<'a> Clone for Op<'a>

Source§

fn clone(&self) -> Op<'a>

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<'a> Copy for Op<'a>

Source§

impl<'a> Debug for Op<'a>

Source§

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

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

impl<'a> Eq for Op<'a>

Source§

impl<'a> PartialEq for Op<'a>

Source§

fn eq(&self, other: &Op<'a>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for Op<'a>

Auto Trait Implementations§

§

impl<'a> Forget for Op<'a>

§

impl<'a> Freeze for Op<'a>
where &'a [u8]: Freeze,

§

impl<'a> Move for Op<'a>

§

impl<'a> RefUnwindSafe for Op<'a>

§

impl<'a> Send for Op<'a>
where &'a [u8]: Send,

§

impl<'a> Sync for Op<'a>

§

impl<'a> Unpin for Op<'a>
where &'a [u8]: Unpin,

§

impl<'a> UnsafeUnpin for Op<'a>
where &'a [u8]: UnsafeUnpin,

§

impl<'a> UnwindSafe for Op<'a>
where &'a [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<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<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.