Struct sample::signal::Output
[−]
[src]
pub struct Output<S> where
S: Signal, { /* fields omitted */ }An output node to which some signal S is Outputing its frames.
It may be more accurate to say that the Output "pull"s frames from the signal.
Methods
impl<S> Output<S> where
S: Signal, [src]
S: Signal,
fn pending_frames(&self) -> usize[src]
The number of frames that have been requested from the Signal S by some other Output
that have not yet been requested by this Output.
This is useful when using an Output to "monitor" some signal, allowing the user to drain
only frames that have already been requested by some other Output.
Example
extern crate sample; use sample::{signal, Signal}; fn main() { let frames = [[0.1], [0.2], [0.3]]; let bus = signal::from_iter(frames.iter().cloned()).bus(); let signal = bus.send(); let mut monitor = bus.send(); assert_eq!(signal.take(3).collect::<Vec<_>>(), vec![[0.1], [0.2], [0.3]]); assert_eq!(monitor.pending_frames(), 3); assert_eq!(monitor.next(), [0.1]); assert_eq!(monitor.pending_frames(), 2); }
Trait Implementations
impl<S> Signal for Output<S> where
S: Signal, [src]
S: Signal,
type Frame = S::Frame
The Frame type returned by the Signal.
fn next(&mut self) -> Self::Frame[src]
Yield the next Frame in the Signal. Read more
fn map<M, F>(self, map: M) -> Map<Self, M, F> where
Self: Sized,
M: FnMut(Self::Frame) -> F,
F: Frame, [src]
Self: Sized,
M: FnMut(Self::Frame) -> F,
F: Frame,
A signal that maps one set of frames to another Read more
fn zip_map<O, M, F>(self, other: O, map: M) -> ZipMap<Self, O, M, F> where
Self: Sized,
M: FnMut(Self::Frame, O::Frame) -> F,
O: Signal,
F: Frame, [src]
Self: Sized,
M: FnMut(Self::Frame, O::Frame) -> F,
O: Signal,
F: Frame,
A signal that maps one set of frames to another Read more
fn add_amp<S>(self, other: S) -> AddAmp<Self, S> where
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>, [src]
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
Provides an iterator that yields the sum of the frames yielded by both other and self in lock-step. Read more
fn mul_amp<S>(self, other: S) -> MulAmp<Self, S> where
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>, [src]
Self: Sized,
S: Signal,
S::Frame: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
Provides an iterator that yields the product of the frames yielded by both other and self in lock-step. Read more
fn offset_amp(
self,
offset: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> OffsetAmp<Self> where
Self: Sized, [src]
self,
offset: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> OffsetAmp<Self> where
Self: Sized,
Provides an iterator that offsets the amplitude of every channel in each frame of the signal by some sample value and yields the resulting frames. Read more
fn scale_amp(
self,
amp: <<Self::Frame as Frame>::Sample as Sample>::Float
) -> ScaleAmp<Self> where
Self: Sized, [src]
self,
amp: <<Self::Frame as Frame>::Sample as Sample>::Float
) -> ScaleAmp<Self> where
Self: Sized,
Produces an Iterator that scales the amplitude of the sample of each channel in every Frame yielded by self by the given amplitude. Read more
fn offset_amp_per_channel<F>(self, amp_frame: F) -> OffsetAmpPerChannel<Self, F> where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>, [src]
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Signed, NumChannels = <Self::Frame as Frame>::NumChannels>,
Produces a new Signal that offsets the amplitude of every Frame in self by the respective amplitudes in each channel of the given amp_frame. Read more
fn scale_amp_per_channel<F>(self, amp_frame: F) -> ScaleAmpPerChannel<Self, F> where
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>, [src]
Self: Sized,
F: Frame<Sample = <<Self::Frame as Frame>::Sample as Sample>::Float, NumChannels = <Self::Frame as Frame>::NumChannels>,
Produces a new Signal that scales the amplitude of every Frame in self by the respective amplitudes in each channel of the given amp_frame. Read more
fn mul_hz<M, I>(self, interpolator: I, mul_per_frame: M) -> MulHz<Self, M, I> where
Self: Sized,
M: Signal<Frame = [f64; 1]>,
I: Interpolator, [src]
Self: Sized,
M: Signal<Frame = [f64; 1]>,
I: Interpolator,
Multiplies the rate at which frames of self are yielded by the given signal. Read more
fn from_hz_to_hz<I>(
self,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Converter<Self, I> where
Self: Sized,
I: Interpolator, [src]
self,
interpolator: I,
source_hz: f64,
target_hz: f64
) -> Converter<Self, I> where
Self: Sized,
I: Interpolator,
Converts the rate at which frames of the Signal are yielded using interpolation. Read more
fn scale_hz<I>(self, interpolator: I, multi: f64) -> Converter<Self, I> where
Self: Sized,
I: Interpolator, [src]
Self: Sized,
I: Interpolator,
Multiplies the rate at which frames of the Signal are yielded by the given value. Read more
fn delay(self, n_frames: usize) -> Delay<Self> where
Self: Sized, [src]
Self: Sized,
Delays the Signal by the given number of frames. Read more
fn into_interleaved_samples(self) -> IntoInterleavedSamples<Self> where
Self: Sized, [src]
Self: Sized,
Converts a Signal into a type that yields the interleaved Samples. Read more
fn clip_amp(
self,
thresh: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> ClipAmp<Self> where
Self: Sized, [src]
self,
thresh: <<Self::Frame as Frame>::Sample as Sample>::Signed
) -> ClipAmp<Self> where
Self: Sized,
Clips the amplitude of each channel in each Frame yielded by self to the given threshold amplitude. Read more
fn inspect<F>(self, inspect: F) -> Inspect<Self, F> where
Self: Sized,
F: FnMut(&Self::Frame), [src]
Self: Sized,
F: FnMut(&Self::Frame),
Create a new Signal that calls the enclosing function on each iteration. Read more
fn bus(self) -> Bus<Self> where
Self: Sized, [src]
Self: Sized,
Moves the Signal into a Bus from which its output may be divided into multiple other Signals in the form of Outputs. Read more
fn take(self, n: usize) -> Take<Self> where
Self: Sized, [src]
Self: Sized,
Converts the Signal into an Iterator that will yield the given number for Frames before returning None. Read more
fn buffered<S>(self, ring_buffer: Bounded<S>) -> Buffered<Self, S> where
Self: Sized,
S: Slice<Element = Self::Frame> + SliceMut, [src]
Self: Sized,
S: Slice<Element = Self::Frame> + SliceMut,
Buffers the signal using the given ring buffer. Read more
fn by_ref(&mut self) -> &mut Self where
Self: Sized, [src]
Self: Sized,
Borrows a Signal rather than consuming it. Read more
impl<S> Drop for Output<S> where
S: Signal, [src]
S: Signal,