Struct 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>

Source

pub fn reset(&mut self)

Source

pub fn set_sample_rate(&mut self, sample_rate: f64)

Source

pub fn tick(&mut self, input: &Frame<f32, X::Inputs>) -> Frame<f32, X::Outputs>

Source

pub fn process( &mut self, size: usize, input: &BufferRef<'_>, output: &mut BufferMut<'_>, )

Source

pub fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame

Source

pub fn inputs(&self) -> usize

Source

pub fn outputs(&self) -> usize

Source

pub fn set_hash(&mut self, hash: u64)

Source

pub fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash

Source

pub fn get_mono(&mut self) -> f32

Source

pub fn get_stereo(&mut self) -> (f32, f32)

Source

pub fn filter_mono(&mut self, x: f32) -> f32

Source

pub fn filter_stereo(&mut self, x: f32, y: f32) -> (f32, f32)

Trait Implementations§

Source§

impl<X> Add<An<X>> for Net
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the + operator.
Source§

fn add(self, y: An<X>) -> Self::Output

Performs the + operation. Read more
Source§

impl<X> Add<An<X>> for f32
where X: AudioNode, X::Inputs: Size<f32>, X::Outputs: Size<f32>,

Source§

type Output = An<Unop<X, FrameAddScalar<<X as AudioNode>::Outputs>>>

The resulting type after applying the + operator.
Source§

fn add(self, y: An<X>) -> Self::Output

Performs the + operation. Read more
Source§

impl<X, Y> Add<An<Y>> for An<X>
where X: AudioNode, Y: AudioNode<Outputs = X::Outputs>, X::Inputs: Add<Y::Inputs>, <X::Inputs as Add<Y::Inputs>>::Output: Size<f32>,

Source§

type Output = An<Binop<FrameAdd<<X as AudioNode>::Outputs>, X, Y>>

The resulting type after applying the + operator.
Source§

fn add(self, y: An<Y>) -> Self::Output

Performs the + operation. Read more
Source§

impl<X> Add<Net> for An<X>
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the + operator.
Source§

fn add(self, y: Net) -> Self::Output

Performs the + operation. Read more
Source§

impl<X> Add<f32> for An<X>
where X: AudioNode, X::Inputs: Size<f32>, X::Outputs: Size<f32>,

Source§

type Output = An<Unop<X, FrameAddScalar<<X as AudioNode>::Outputs>>>

The resulting type after applying the + operator.
Source§

fn add(self, y: f32) -> Self::Output

Performs the + operation. Read more
Source§

impl<X: AudioNode + Sync + Send> AudioUnit for An<X>
where X::Inputs: Size<f32>, X::Outputs: Size<f32>,

Source§

fn reset(&mut self)

Reset the input state of the unit to an initial state where it has not processed any data. In other words, reset time to zero.
Source§

fn set_sample_rate(&mut self, sample_rate: f64)

Set the sample rate of the unit. The default sample rate is 44100 Hz. The unit is allowed to reset itself here in response to sample rate changes. If the sample rate stays unchanged, then the goal is to maintain current state.
Source§

fn tick(&mut self, input: &[f32], output: &mut [f32])

Process one sample. The length of input and output must be equal to inputs and outputs, respectively.
Source§

fn process( &mut self, size: usize, input: &BufferRef<'_>, output: &mut BufferMut<'_>, )

Process up to 64 (MAX_BUFFER_SIZE) samples. If size is zero then this is a no-op, which is permitted.
Source§

fn set(&mut self, setting: Setting)

Set a parameter. What formats are recognized depends on the component.
Source§

fn inputs(&self) -> usize

Number of inputs to this unit. Equals size of the input argument in tick and process. This should be fixed after construction.
Source§

fn outputs(&self) -> usize

Number of outputs from this unit. Equals size of the output argument in tick and process. This should be fixed after construction.
Source§

fn route(&mut self, input: &SignalFrame, frequency: f64) -> SignalFrame

Route constants, latencies and frequency responses at frequency Hz from inputs to outputs. Return output signal.
Source§

fn get_id(&self) -> u64

Return an ID code for this type of unit.
Source§

fn set_hash(&mut self, hash: u64)

Set unit pseudorandom phase hash. Override this to use the hash. This is called from ping (only). It should not be called by users.
Source§

fn ping(&mut self, probe: bool, hash: AttoHash) -> AttoHash

Ping contained AudioUnits and AudioNodes 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 footprint(&self) -> usize

Memory footprint of this unit in bytes, without counting buffers and other allocations.
Source§

fn allocate(&mut self)

Preallocate all needed memory, including buffers for block processing.
Source§

fn get_mono(&mut self) -> f32

Retrieve the next mono sample from a generator. The node must have no inputs and 1 or 2 outputs. If there are two outputs, average them. Read more
Source§

fn get_stereo(&mut self) -> (f32, f32)

Retrieve the next stereo sample (left, right) from a generator. The node must have no inputs and 1 or 2 outputs. If there is just one output, duplicate it. Read more
Source§

fn filter_mono(&mut self, x: f32) -> f32

Filter the next mono sample x. The node must have exactly 1 input and 1 output. Read more
Source§

fn filter_stereo(&mut self, x: f32, y: f32) -> (f32, f32)

Filter the next stereo sample (x, y). The node must have exactly 2 inputs and 2 outputs. Read more
Source§

fn response(&mut self, output: usize, frequency: f64) -> Option<Complex64>

Evaluate frequency response of output at frequency Hz. Any linear response can be composed. Return None if there is no response or it could not be calculated. Read more
Source§

fn response_db(&mut self, output: usize, frequency: f64) -> Option<f64>

Evaluate frequency response of 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 more
Source§

fn latency(&mut self) -> Option<f64>

Causal latency in (fractional) samples. After a reset, we can discard this many samples from the output to avoid incurring a pre-delay. The latency may depend on the sample rate. Read more
Source§

fn display(&mut self) -> String

Print information about this unit into a string.
Source§

impl<X> BitAnd<An<X>> for Net
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the & operator.
Source§

fn bitand(self, y: An<X>) -> Self::Output

Performs the & operation. Read more
Source§

impl<X, Y> BitAnd<An<Y>> for An<X>
where X: AudioNode, Y: AudioNode<Inputs = X::Inputs, Outputs = X::Outputs>,

Source§

type Output = An<Bus<X, Y>>

The resulting type after applying the & operator.
Source§

fn bitand(self, y: An<Y>) -> Self::Output

Performs the & operation. Read more
Source§

impl<X> BitAnd<Net> for An<X>
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the & operator.
Source§

fn bitand(self, y: Net) -> Self::Output

Performs the & operation. Read more
Source§

impl<X> BitOr<An<X>> for Net
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the | operator.
Source§

fn bitor(self, y: An<X>) -> Self::Output

Performs the | operation. Read more
Source§

impl<X, Y> BitOr<An<Y>> for An<X>
where X: AudioNode, Y: AudioNode, X::Inputs: Add<Y::Inputs>, X::Outputs: Add<Y::Outputs>, <X::Inputs as Add<Y::Inputs>>::Output: Size<f32>, <X::Outputs as Add<Y::Outputs>>::Output: Size<f32>,

Source§

type Output = An<Stack<X, Y>>

The resulting type after applying the | operator.
Source§

fn bitor(self, y: An<Y>) -> Self::Output

Performs the | operation. Read more
Source§

impl<X> BitOr<Net> for An<X>
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the | operator.
Source§

fn bitor(self, y: Net) -> Self::Output

Performs the | operation. Read more
Source§

impl<X> BitXor<An<X>> for Net
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, y: An<X>) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<X, Y> BitXor<An<Y>> for An<X>
where X: AudioNode, Y: AudioNode<Inputs = X::Inputs>, X::Outputs: Add<Y::Outputs>, <X::Outputs as Add<Y::Outputs>>::Output: Size<f32>,

Source§

type Output = An<Branch<X, Y>>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, y: An<Y>) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<X> BitXor<Net> for An<X>
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, y: Net) -> Self::Output

Performs the ^ operation. Read more
Source§

impl<X: Clone + AudioNode> Clone for An<X>

Source§

fn clone(&self) -> An<X>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<X: AudioNode> Deref for An<X>

Source§

type Target = X

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<X: AudioNode> DerefMut for An<X>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<X> Mul<An<X>> for Net
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the * operator.
Source§

fn mul(self, y: An<X>) -> Self::Output

Performs the * operation. Read more
Source§

impl<X> Mul<An<X>> for f32
where X: AudioNode, X::Inputs: Size<f32>, X::Outputs: Size<f32>,

Source§

type Output = An<Unop<X, FrameMulScalar<<X as AudioNode>::Outputs>>>

The resulting type after applying the * operator.
Source§

fn mul(self, y: An<X>) -> Self::Output

Performs the * operation. Read more
Source§

impl<X, Y> Mul<An<Y>> for An<X>
where X: AudioNode, Y: AudioNode<Outputs = X::Outputs>, X::Inputs: Add<Y::Inputs>, <X::Inputs as Add<Y::Inputs>>::Output: Size<f32>,

Source§

type Output = An<Binop<FrameMul<<X as AudioNode>::Outputs>, X, Y>>

The resulting type after applying the * operator.
Source§

fn mul(self, y: An<Y>) -> Self::Output

Performs the * operation. Read more
Source§

impl<X> Mul<Net> for An<X>
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the * operator.
Source§

fn mul(self, y: Net) -> Self::Output

Performs the * operation. Read more
Source§

impl<X> Mul<f32> for An<X>
where X: AudioNode, X::Inputs: Size<f32>, X::Outputs: Size<f32>,

Source§

type Output = An<Unop<X, FrameMulScalar<<X as AudioNode>::Outputs>>>

The resulting type after applying the * operator.
Source§

fn mul(self, y: f32) -> Self::Output

Performs the * operation. Read more
Source§

impl<X> Neg for An<X>
where X: AudioNode, X::Outputs: Size<f32>,

Source§

type Output = An<Unop<X, FrameNeg<<X as AudioNode>::Outputs>>>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<X> Not for An<X>
where X: AudioNode,

The thru operator makes output arity match input arity and passes through missing outputs.

Source§

type Output = An<Thru<X>>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl<X> Shr<An<X>> for Net
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the >> operator.
Source§

fn shr(self, y: An<X>) -> Self::Output

Performs the >> operation. Read more
Source§

impl<X, Y> Shr<An<Y>> for An<X>
where X: AudioNode, Y: AudioNode<Inputs = X::Outputs>,

Source§

type Output = An<Pipe<X, Y>>

The resulting type after applying the >> operator.
Source§

fn shr(self, y: An<Y>) -> Self::Output

Performs the >> operation. Read more
Source§

impl<X> Shr<Net> for An<X>
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the >> operator.
Source§

fn shr(self, y: Net) -> Self::Output

Performs the >> operation. Read more
Source§

impl<X> Sub<An<X>> for Net
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the - operator.
Source§

fn sub(self, y: An<X>) -> Self::Output

Performs the - operation. Read more
Source§

impl<X> Sub<An<X>> for f32
where X: AudioNode, X::Inputs: Size<f32>, X::Outputs: Size<f32>,

Source§

type Output = An<Unop<X, FrameNegAddScalar<<X as AudioNode>::Outputs>>>

The resulting type after applying the - operator.
Source§

fn sub(self, y: An<X>) -> Self::Output

Performs the - operation. Read more
Source§

impl<X, Y> Sub<An<Y>> for An<X>
where X: AudioNode, Y: AudioNode<Outputs = X::Outputs>, X::Outputs: Size<f32>, X::Inputs: Size<f32> + Add<Y::Inputs>, Y::Inputs: Size<f32>, <X::Inputs as Add<Y::Inputs>>::Output: Size<f32>,

Source§

type Output = An<Binop<FrameSub<<X as AudioNode>::Outputs>, X, Y>>

The resulting type after applying the - operator.
Source§

fn sub(self, y: An<Y>) -> Self::Output

Performs the - operation. Read more
Source§

impl<X> Sub<Net> for An<X>
where X: AudioNode + Send + Sync + 'static,

Source§

type Output = Net

The resulting type after applying the - operator.
Source§

fn sub(self, y: Net) -> Self::Output

Performs the - operation. Read more
Source§

impl<X> Sub<f32> for An<X>
where X: AudioNode, X::Inputs: Size<f32>, X::Outputs: Size<f32>,

Source§

type Output = An<Unop<X, FrameAddScalar<<X as AudioNode>::Outputs>>>

The resulting type after applying the - operator.
Source§

fn sub(self, y: f32) -> Self::Output

Performs the - operation. Read more

Auto Trait Implementations§

§

impl<X> Freeze for An<X>
where X: Freeze,

§

impl<X> RefUnwindSafe for An<X>
where X: RefUnwindSafe,

§

impl<X> Send for An<X>

§

impl<X> Sync for An<X>

§

impl<X> Unpin for An<X>
where X: Unpin,

§

impl<X> UnwindSafe for An<X>
where X: 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<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.