Trait sorceress::synthdef::Input[][src]

pub trait Input: Sized {
    fn into_value(self) -> Value;

    fn add(self, rhs: impl Input) -> Value { ... }
fn sub(self, rhs: impl Input) -> Value { ... }
fn mul(self, rhs: impl Input) -> Value { ... }
fn div(self, rhs: impl Input) -> Value { ... }
fn idiv(self, rhs: impl Input) -> Value { ... }
fn modulo(self, divisor: impl Input) -> Value { ... }
fn madd(self, mul: impl Input, add: impl Input) -> Value { ... }
fn midicps(self) -> Value { ... }
fn cpsmidi(self) -> Value { ... }
fn range(self, lo: impl Input, hi: impl Input) -> Value { ... } }

A trait for values that can be used in UGen graphs.

This trait is primarily used as a bound on the arguments to UGen structs. This allows for a wide range of types to be given as parameters. Input is implemented by:

If a vector of Inputs is passed to a unit generator, multichannel expansion will be applied.

Examples

Multichannel expansion:

use sorceress::{synthdef::SynthDef, ugen};

// The following two synth definitions are equivalent.

let synthdef1 = SynthDef::new("multichannel", |_| {
    ugen::Out::ar().channels(ugen::SinOsc::ar().freq(vec![440, 220]))
});

let synthdef2 = SynthDef::new("multichannel", |_| {
    ugen::Out::ar().channels(vec![
        ugen::SinOsc::ar().freq(440),
        ugen::SinOsc::ar().freq(220),
    ])
});

Required methods

fn into_value(self) -> Value[src]

Converts the input into a Value.

Loading content...

Provided methods

fn add(self, rhs: impl Input) -> Value[src]

Adds an Input to another.

fn sub(self, rhs: impl Input) -> Value[src]

Subtracts an Input from another.

fn mul(self, rhs: impl Input) -> Value[src]

Multiplies an Input by another.

fn div(self, rhs: impl Input) -> Value[src]

Divides an Input by another using floating point division.

fn idiv(self, rhs: impl Input) -> Value[src]

Divides an Input by another using integer division.

fn modulo(self, divisor: impl Input) -> Value[src]

Modulo operator.

fn madd(self, mul: impl Input, add: impl Input) -> Value[src]

Efficiently multiplies the signal by mul and adds add.

Uses the MulAdd UGen under the hood.

fn midicps(self) -> Value[src]

Converts midi note numbers into cycles per seconds (Hz).

fn cpsmidi(self) -> Value[src]

Converts cycles per seconds (Hz) into midi note numbers.

fn range(self, lo: impl Input, hi: impl Input) -> Value[src]

Scales the output of this UGen to be within the range of lo and hi.

This Note that range expects the default output range, and thus should not be used in conjunction with mul and add arguments.

Loading content...

Implementations on Foreign Types

impl Input for f32[src]

impl Input for i32[src]

impl Input for usize[src]

impl<T> Input for Vec<T> where
    T: Input
[src]

Loading content...

Implementors

impl Input for DoneAction[src]

impl Input for MouseWarp[src]

impl Input for Parameter[src]

impl Input for Value[src]

impl Input for Balance2[src]

impl Input for CombN[src]

impl Input for Control[src]

impl Input for DiskIn[src]

impl Input for DiskOut[src]

impl Input for EnvGen[src]

impl Input for Impulse[src]

impl Input for In[src]

impl Input for LFSaw[src]

impl Input for MouseX[src]

impl Input for MouseY[src]

impl Input for NumOutputBuses[src]

impl Input for OffsetOut[src]

impl Input for Out[src]

impl Input for PMOsc[src]

impl Input for Pan2[src]

impl Input for PlayBuf[src]

impl Input for RLPF[src]

impl Input for Saw[src]

impl Input for SinOsc[src]

impl Input for SoundIn[src]

impl Input for Trig[src]

Loading content...