Struct fundsp::combinator::An
source · pub struct An<X: AudioNode>(pub X);
Expand description
AudioNode wrapper that implements operators and traits.
Tuple Fields§
§0: X
Implementations§
source§impl<X: AudioNode> An<X>
impl<X: AudioNode> An<X>
pub fn reset(&mut self)
pub fn set_sample_rate(&mut self, sample_rate: f64)
pub fn tick( &mut self, input: &Frame<X::Sample, X::Inputs> ) -> Frame<X::Sample, X::Outputs>
pub fn process( &mut self, size: usize, input: &[&[X::Sample]], output: &mut [&mut [X::Sample]] )
pub fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame
pub fn inputs(&self) -> usize
pub fn outputs(&self) -> usize
pub fn set_hash(&mut self, hash: u64)
pub fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash
pub fn get_mono(&mut self) -> X::Sample
pub fn get_stereo(&mut self) -> (X::Sample, X::Sample)
pub fn filter_mono(&mut self, x: X::Sample) -> X::Sample
pub fn filter_stereo( &mut self, x: X::Sample, y: X::Sample ) -> (X::Sample, X::Sample)
Trait Implementations§
source§impl<X> Add<An<X>> for f32
impl<X> Add<An<X>> for f32
constant + X
binary operator: Adds constant
to outputs of X
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X> Add<An<X>> for f64
impl<X> Add<An<X>> for f64
constant + X
binary operator: Adds constant
to outputs of X
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X, Y> Add<An<Y>> for An<X>
impl<X, Y> Add<An<Y>> for An<X>
+
binary operator: Sums outputs of two nodes with disjoint inputs.
The nodes must have the same number of outputs.
source§impl<X> Add<f32> for An<X>
impl<X> Add<f32> for An<X>
X + constant
binary operator: Adds constant
to outputs of X
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X> Add<f64> for An<X>
impl<X> Add<f64> for An<X>
X + constant
binary operator: Adds constant
to outputs of X
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X: AudioNode<Sample = f32> + Sync + Send> AudioUnit32 for An<X>
impl<X: AudioNode<Sample = f32> + Sync + Send> AudioUnit32 for An<X>
source§fn reset(&mut self)
fn reset(&mut self)
source§fn set_sample_rate(&mut self, sample_rate: f64)
fn set_sample_rate(&mut self, sample_rate: f64)
source§fn tick(&mut self, input: &[f32], output: &mut [f32])
fn tick(&mut self, input: &[f32], output: &mut [f32])
input
and output
must be equal to inputs
and outputs
, respectively.source§fn process(&mut self, size: usize, input: &[&[f32]], output: &mut [&mut [f32]])
fn process(&mut self, size: usize, input: &[&[f32]], output: &mut [&mut [f32]])
size
samples.
If size
is zero then this is a no-op, which is permitted.
The number of input and output buffers must be equal to inputs
and outputs
, respectively.source§fn inputs(&self) -> usize
fn inputs(&self) -> usize
tick
and process
.
This should be fixed after construction.source§fn outputs(&self) -> usize
fn outputs(&self) -> usize
tick
and process
.
This should be fixed after construction.source§fn set_hash(&mut self, hash: u64)
fn set_hash(&mut self, hash: u64)
ping
(only). It should not be called by users.
The default implementation does nothing.source§fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash
fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash
AudioUnit
s and AudioNode
s to obtain
a deterministic pseudorandom hash. The local hash includes children, too.
Leaf nodes should not need to override this.
If probe
is true, then this is a probe for computing the network hash
and set_hash
should not be called yet.
To set a custom hash for a graph, call this method with ping
set to false and hash
initialized with the custom hash.source§fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame
fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame
frequency
Hz
from inputs to outputs. Return output signal.source§fn footprint(&self) -> usize
fn footprint(&self) -> usize
source§fn allocate(&mut self)
fn allocate(&mut self)
source§fn response(&mut self, output: usize, frequency: f64) -> Option<Complex64>
fn response(&mut self, output: usize, frequency: f64) -> Option<Complex64>
output
at frequency
Hz.
Any linear response can be composed.
Return None
if there is no response or it could not be calculated. Read moresource§fn response_db(&mut self, output: usize, frequency: f64) -> Option<f64>
fn response_db(&mut self, output: usize, frequency: f64) -> Option<f64>
output
in dB at frequency
Hz.
Any linear response can be composed.
Return None
if there is no response or it could not be calculated. Read moresource§fn latency(&mut self) -> Option<f64>
fn latency(&mut self) -> Option<f64>
source§fn get_mono(&mut self) -> f32
fn get_mono(&mut self) -> f32
source§fn get_stereo(&mut self) -> (f32, f32)
fn get_stereo(&mut self) -> (f32, f32)
source§fn filter_mono(&mut self, x: f32) -> f32
fn filter_mono(&mut self, x: f32) -> f32
x
.
The node must have exactly 1 input and 1 output. Read moresource§impl<X: AudioNode<Sample = f64> + Sync + Send> AudioUnit64 for An<X>
impl<X: AudioNode<Sample = f64> + Sync + Send> AudioUnit64 for An<X>
source§fn reset(&mut self)
fn reset(&mut self)
source§fn set_sample_rate(&mut self, sample_rate: f64)
fn set_sample_rate(&mut self, sample_rate: f64)
source§fn tick(&mut self, input: &[f64], output: &mut [f64])
fn tick(&mut self, input: &[f64], output: &mut [f64])
input
and output
must be equal to inputs
and outputs
, respectively.source§fn process(&mut self, size: usize, input: &[&[f64]], output: &mut [&mut [f64]])
fn process(&mut self, size: usize, input: &[&[f64]], output: &mut [&mut [f64]])
size
samples.
If size
is zero then this is a no-op, which is permitted.
The number of input and output buffers must be equal to inputs
and outputs
, respectively.source§fn inputs(&self) -> usize
fn inputs(&self) -> usize
tick
and process
.
This should be fixed after construction.source§fn outputs(&self) -> usize
fn outputs(&self) -> usize
tick
and process
.
This should be fixed after construction.source§fn set_hash(&mut self, hash: u64)
fn set_hash(&mut self, hash: u64)
ping
(only). It should not be called by users.
The default implementation does nothing.source§fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash
fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash
AudioUnit
s and AudioNode
s to obtain
a deterministic pseudorandom hash. The local hash includes children, too.
Leaf nodes should not need to override this.
If probe
is true, then this is a probe for computing the network hash
and set_hash
should not be called yet.
To set a custom hash for a graph, call this method with ping
set to false and hash
initialized with the custom hash.source§fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame
fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame
frequency
Hz
from inputs to outputs. Return output signal.source§fn footprint(&self) -> usize
fn footprint(&self) -> usize
source§fn allocate(&mut self)
fn allocate(&mut self)
source§fn response(&mut self, output: usize, frequency: f64) -> Option<Complex64>
fn response(&mut self, output: usize, frequency: f64) -> Option<Complex64>
output
at frequency
Hz.
Any linear response can be composed.
Return None
if there is no response or it could not be calculated. Read moresource§fn response_db(&mut self, output: usize, frequency: f64) -> Option<f64>
fn response_db(&mut self, output: usize, frequency: f64) -> Option<f64>
output
in dB at frequency
Hz.
Any linear response can be composed.
Return None
if there is no response or it could not be calculated. Read moresource§fn latency(&mut self) -> Option<f64>
fn latency(&mut self) -> Option<f64>
source§fn get_mono(&mut self) -> f64
fn get_mono(&mut self) -> f64
source§fn get_stereo(&mut self) -> (f64, f64)
fn get_stereo(&mut self) -> (f64, f64)
source§fn filter_mono(&mut self, x: f64) -> f64
fn filter_mono(&mut self, x: f64) -> f64
x
.
The node must have exactly 1 input and 1 output. Read moresource§impl<T, X, Y> BitAnd<An<Y>> for An<X>
impl<T, X, Y> BitAnd<An<Y>> for An<X>
&
binary operator: The bus operator mixes together units with similar connectivity that share inputs and outputs.
source§impl<T, X, Y> BitOr<An<Y>> for An<X>
impl<T, X, Y> BitOr<An<Y>> for An<X>
|
binary operator: The stack operator stacks inputs and outputs of two nodes running in parallel.
source§impl<T, X, Y> BitXor<An<Y>> for An<X>
impl<T, X, Y> BitXor<An<Y>> for An<X>
^
binary operator: The branch operator sources two nodes from the same inputs and concatenates their outputs.
source§impl<X> Mul<An<X>> for f32
impl<X> Mul<An<X>> for f32
constant * X
binary operator: Multiplies outputs of X
with constant
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X> Mul<An<X>> for f64
impl<X> Mul<An<X>> for f64
constant * X
binary operator: Multiplies outputs of X
with constant
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X, Y> Mul<An<Y>> for An<X>
impl<X, Y> Mul<An<Y>> for An<X>
*
binary operator: Multiplies outputs of two nodes with disjoint inputs.
The nodes must have the same number of outputs.
source§impl<X> Mul<f32> for An<X>
impl<X> Mul<f32> for An<X>
X * constant
binary operator: Multiplies outputs of X
with constant
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X> Mul<f64> for An<X>
impl<X> Mul<f64> for An<X>
X * constant
binary operator: Multiplies outputs of X
with constant
.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X> Not for An<X>where
X: AudioNode,
impl<X> Not for An<X>where
X: AudioNode,
!
unary operator: The thru operator makes output arity match input arity
and passes through missing outputs.
source§impl<T, X, Y> Shr<An<Y>> for An<X>
impl<T, X, Y> Shr<An<Y>> for An<X>
>>
binary operator: The pipe operator pipes outputs of left node to inputs of right node.
Number of outputs on the left side and number of inputs on the right side must match.
source§impl<X> Sub<An<X>> for f32
impl<X> Sub<An<X>> for f32
constant - X
binary operator: Negates X
and adds constant
to its outputs.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X> Sub<An<X>> for f64
impl<X> Sub<An<X>> for f64
constant - X
binary operator: Negates X
and adds constant
to its outputs.
Broadcasts constant
to an arbitrary number of channels.
source§impl<X, Y> Sub<An<Y>> for An<X>
impl<X, Y> Sub<An<Y>> for An<X>
-
binary operator: The difference of outputs of two nodes with disjoint inputs.
The nodes must have the same number of outputs.
source§impl<X> Sub<f32> for An<X>
impl<X> Sub<f32> for An<X>
X - constant
binary operator: Subtracts constant
from outputs of X
.
Broadcasts constant
to an arbitrary number of channels.