Trait sorceress::synthdef::Input [−][src]
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:
- Numeric types -
i32
,f32
, andusize
- Synth definition parameters -
Parameter
- All UGen structs
Value
- A
Vec
of other inputs
If a vector of Input
s 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
.
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.
Implementations on Foreign Types
impl Input for f32
[src]
fn into_value(self) -> Value
[src]
impl Input for i32
[src]
fn into_value(self) -> Value
[src]
impl Input for usize
[src]
fn into_value(self) -> Value
[src]
impl<T> Input for Vec<T> where
T: Input,
[src]
T: Input,