XbadPCM
Safe (and optionally no-std) Rust crate for encoding and decoding Xbox ADPCM blocks.
Decoding example
Here is example code for decoding stereo audio.
use ;
let adpcm_data = read_some_adpcm_blocks;
let mut output = ;
// Two channels
let mut encoder = new;
// Decode
encoder.decode.unwrap;
assert!;
Encoding example
Here is example code for encoding stereo audio.
use ;
let = read_some_pcm_samples;
let mut output = Vec new;
// Two channels with a lookahead of three samples
let mut encoder = new;
// Encode
encoder.encode.unwrap;
// Finish encoding
encoder.finish.unwrap;
assert!;
No-std support
The crate is fully functional without the Rust Standard Library, but it is enabled automatically to provide traits for
XboxADPCMEncodeSink
and XboxADPCMDecodeSink
on vectors.
To disable using the standard library, put default-features = false
in the dependency declaration in your Cargo.toml.
See Features - The Cargo Book for more information.
Acknowledgements
The encoder is based off of David Bryant's ADPCM-XQ encoder, an IMA-ADPCM encoder which can be found on GitHub at dbry/adpcm-xq.