Crate oddio[−][src]
Expand description
Lightweight game audio
let (mut scene_handle, scene) = oddio::split(oddio::SpatialScene::new(sample_rate, 0.1)); // In audio callback: let out_frames = oddio::frame_stereo(data); oddio::run(&scene, output_sample_rate, out_frames); // In game logic: let frames = oddio::FramesSignal::from(oddio::Frames::from_slice(sample_rate, &frames)); let mut handle = scene_handle.control::<oddio::SpatialScene, _>() .play(frames, oddio::SpatialOptions { position, velocity, ..Default::default() }); // When position/velocity changes: handle.control::<oddio::Spatial<_>, _>().set_motion(position, velocity, false);
Key primitives:
Frames
stores static audio data, which can be played with aFramesSignal
Mixer
allows multiple signals to be played concurrently and controlled during playbackSpatialScene
is a mixer that spatializes its signalsHandle
allows control of a signal while it’s playing, from a mixer orsplit
run
writes frames from aSignal
into an output buffer
Structs
Smoothly adjusts gain over time to keep average (RMS) signal level within a target range
Configuration for an Adapt
filter, passed to Adapt::new
A constant signal, useful for testing
Loops Frames
end-to-end to construct a repeating signal
A sequence of static audio frames at a particular sample rate
An audio signal backed by a static sequence of samples
Thread-safe control for a FramesSignal
, giving access to current playback location.
Scales amplitude by a dynamically-adjustable factor
Thread-safe control for a Gain
filter
Handle for manipulating a signal owned elsewhere
Index
value for FilterHaving
representing the first filter in the chain
Handle for controlling a Mixer
from another thread
Adapts a mono signal to output stereo by duplicating its output
Smoothly maps a signal of any range into (-1, 1)
A trivial Signal
that produces a sine wave of a particular frequency, forever
Helper to linearly ramp a parameter towards a target value
An individual spatialized signal
Control for updating the motion of a spatial signal
Passed to SpatialSceneControl::play
Signal
for stereo output from a spatial scene
Control for modifying a SpatialScene
Scales rate of playback by a dynamically-adjustable factor
Thread-safe control for a Speed
filter
A concurrently controlled Signal
A source that can be paused or permanently stopped
Thread-safe control for a Stop
filter
Dynamic audio from an external source
Thread-safe control for a Stream
SPSC queue that only retains the last element sent
Index
value for FilterHaving
representing the filter at position T+1
Traits
A Signal
or transformer that can be safely controlled from another thread
A wrapper which transforms a Signal
Filter chains that contain a T
at any position
A single frame of audio data, encoding one sample for each channel
Types that can be linearly interpolated, for use with Smoothed
An audio signal
Functions
Convert a slice of interleaved stereo data into a slice of stereo frames
Populate out
with frames from signal
at sample_rate
Split concurrent controls out of a signal
Type Definitions
Unitless instantaneous sound wave amplitude measurement