Struct dsp::signal::Output
[−]
[src]
pub struct Output<S> where S: Signal, S::Item: Frame {
// some fields omitted
}
An output node to which some signal S
is Output
ing 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, S::Item: Frame
fn pending_frames(&self) -> usize
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; fn main() { let frames = [[0.1], [0.2], [0.3]]; let bus = frames.iter().cloned().bus(); let mut signal = bus.send(); let mut monitor = bus.send(); assert_eq!(signal.collect::<Vec<_>>(), vec![[0.1], [0.2], [0.3]]); assert_eq!(monitor.pending_frames(), 3); assert_eq!(monitor.next(), Some([0.1])); assert_eq!(monitor.pending_frames(), 2); }