pub trait Signal {
type Frame;
// Required method
fn sample(&mut self, interval: f32, out: &mut [Self::Frame]);
// Provided method
fn is_finished(&self) -> bool { ... }
}
Expand description
An audio signal
This interface is intended for use only from the code actually generating an audio signal for
output. For example, in a real-time application, Signal
s will typically be owned by the
real-time audio thread and not directly accessible from elsewhere. Access to an active signal
for other purposes (e.g. to adjust parameters) is generally through a control handle returned by
its constructor.
To ensure glitch-free audio, none of these methods should perform any operation that may wait. This includes locks, memory allocation or freeing, and even unbounded compare-and-swap loops.
Required Associated Types§
Required Methods§
Provided Methods§
sourcefn is_finished(&self) -> bool
fn is_finished(&self) -> bool
Whether future calls to sample
with a nonnegative interval
will only produce zeroes
Commonly used to determine when a Signal
can be discarded.