Trait oddio::Signal[][src]

pub trait Signal {
    type Frame;
    fn sample(&self, interval: f32, out: &mut [Self::Frame]);

    fn remaining(&self) -> f32 { ... }
fn into_stereo(self) -> MonoToStereo<Self>
    where
        Self: Signal<Frame = Sample> + Sized
, { ... }
fn with_gain(self) -> Gain<Self>
    where
        Self: Sized
, { ... } }

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 Handle, using signal-specific interfaces that implement wait-free inter-thread communication.

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.

Associated Types

type Frame[src]

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

Loading content...

Required methods

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

Sample every interval seconds starting at offset from the cursor

interval and offset may be negative.

Loading content...

Provided methods

fn remaining(&self) -> f32[src]

Seconds until data runs out

May be infinite for unbounded signals, or negative after advancing past the end.

fn into_stereo(self) -> MonoToStereo<Self> where
    Self: Signal<Frame = Sample> + Sized
[src]

Convert a signal from mono to stereo by duplicating its output across both channels

fn with_gain(self) -> Gain<Self> where
    Self: Sized
[src]

Apply a dynamic gain control

Loading content...

Implementors

impl Signal for Sine[src]

type Frame = Sample

impl Signal for SpatialScene[src]

type Frame = [Sample; 2]

impl Signal for Stream[src]

type Frame = Sample

impl<S: ?Sized> Signal for SplitSignal<S> where
    S: Signal
[src]

type Frame = S::Frame

impl<T: Frame + Copy> Signal for Cycle<T>[src]

type Frame = T

impl<T: Frame + Copy> Signal for FramesSignal<T>[src]

type Frame = T

impl<T: Frame> Signal for Mixer<T>[src]

type Frame = T

impl<T: Signal + ?Sized> Signal for Stop<T>[src]

type Frame = T::Frame

impl<T: Signal> Signal for Gain<T> where
    T::Frame: Frame
[src]

type Frame = T::Frame

impl<T: Signal> Signal for Reinhard<T> where
    T::Frame: Frame
[src]

type Frame = T::Frame

impl<T: Signal> Signal for Speed<T> where
    T::Frame: Frame
[src]

type Frame = T::Frame

impl<T: Signal<Frame = Sample>> Signal for MonoToStereo<T>[src]

type Frame = [Sample; 2]

Loading content...