Host audio output for generated sample buffers, in Rust.
You produce interleaved PCM at whatever rate you generate it -- an emulator, a decomp's audio driver, a synth -- and arie resamples it to the output device and plays it back. Your source never has to know the device's rate or buffer size.
The API is push/queue: hand arie samples as you make them, it owns the buffering, resampling, and playback, and reports how much is queued so you can pace yourself.
use arie::{AudioPlayer, AudioConfig, SourceChannels};
use std::time::Duration;
let mut player = AudioPlayer::new(AudioConfig {
sample_rate_hz: 32_000,
channels: SourceChannels::Stereo,
prebuffer: Duration::from_millis(80),
maximum_software_queue: Duration::from_millis(250),
})?;
player.queue_interleaved_i16(&samples)?; // as you generate themUnder the hood it's a CPAL backend with continuous band-limited resampling from any source rate to the device -- including the awkward near-prime rates hardware tends to land on. There's a versioned C ABI alongside the Rust API for embedding in non-Rust hosts.