Trait oddio::Signal

source ·
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, Signals 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§

source

type Frame

Type of frames yielded by sample, e.g. [Sample; 2] for stereo

Required Methods§

source

fn sample(&mut self, interval: f32, out: &mut [Self::Frame])

Sample frames separated by interval seconds each

Provided Methods§

source

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.

Implementations on Foreign Types§

source§

impl<T: Signal + ?Sized> Signal for Box<T>

§

type Frame = <T as Signal>::Frame

source§

fn sample(&mut self, interval: f32, out: &mut [T::Frame])

source§

fn is_finished(&self) -> bool

Implementors§

source§

impl Signal for Sine

§

type Frame = f32

source§

impl Signal for SpatialScene

§

type Frame = [f32; 2]

source§

impl<T: Clone> Signal for Constant<T>

§

type Frame = T

source§

impl<T: Frame + Copy> Signal for Cycle<T>

§

type Frame = T

source§

impl<T: Frame + Copy> Signal for FramesSignal<T>

§

type Frame = T

source§

impl<T: Frame + Copy> Signal for Stream<T>

§

type Frame = T

source§

impl<T: Frame> Signal for Mixer<T>

§

type Frame = T

source§

impl<T: Signal + ?Sized> Signal for Downmix<T>
where T::Frame: Frame,

§

type Frame = f32

source§

impl<T: Signal + ?Sized> Signal for FixedGain<T>
where T::Frame: Frame,

§

type Frame = <T as Signal>::Frame

source§

impl<T: Signal> Signal for Adapt<T>
where T::Frame: Frame,

§

type Frame = <T as Signal>::Frame

source§

impl<T: Signal> Signal for Fader<T>
where T::Frame: Frame,

§

type Frame = <T as Signal>::Frame

source§

impl<T: Signal> Signal for Gain<T>
where T::Frame: Frame,

§

type Frame = <T as Signal>::Frame

source§

impl<T: Signal> Signal for Reinhard<T>
where T::Frame: Frame,

§

type Frame = <T as Signal>::Frame

source§

impl<T: Signal> Signal for Speed<T>
where T::Frame: Frame,

§

type Frame = <T as Signal>::Frame

source§

impl<T: Signal> Signal for Tanh<T>
where T::Frame: Frame,

§

type Frame = <T as Signal>::Frame

source§

impl<T: Signal<Frame = Sample>> Signal for MonoToStereo<T>

§

type Frame = [f32; 2]