What it is
Platform code lives behind one trait; everything above it is platform-free and testable without a sound card. The render function fills an interleaved f32 buffer on the audio thread and must not block, lock or allocate; a sink that cannot run the exact config returns SinkError::UnsupportedConfig instead of silently running at another rate.
Key types and modules
AudioSink,ManualSink(no device: the caller pulls blocks, so engine code is deterministic to test) andCpalSink(featurecpal: ALSA on Linux, AAudio on Android, and the other platforms cpal supports; featurepipewireadds its native PipeWire backend).SceneandSceneRenderer: sounds plus events sorted by frame, mixed block by block from a fixed pool of 64 voices; a looping scene wraps on its exact frame.enginereturns anEnginefor the control thread and anEngineAudiofor the device callback, with commands through a bounded lock-free queue and a dry bus tap.render_offlineandrender_to_end: the same mixer without a device, so an export matches live playback sample for sample.WaveformPlayer: plays one waveform from weirdnet-media with play, pause, seek, loop and gain from any thread.router: a fan-in router of named endpoints (audio-thread sources, inputs fed from another thread, buses, taps and the device) with routes that carry gain, mute and solo, per-destination limiters and peak reports. With the featureroute,RouterControlimplements the weirdnet-audio-routeExecutor.
Usage
[dependencies]
weirdnet-audio-engine = "0.5.0"Where it fits
- Builds on weirdnet-media, weirdnet-audio-route.
- Used by weirdnet-streaming, weirdnet-audio-plugin.
- License: BSD-3-Clause.
Version 0.5.0 is on crates.io (docs.rs, repository).
cargo test never opens an audio device; the device tests refuse to run unless the audio server is a private one.