Crate hps_decode
source ·Expand description
A library for parsing and decoding Super Smash Bros. Melee music files.
Quick Start
Here is a quick example of how to play a stereo .hps
file with the
rodio-source
feature flag and rodio 0.17:
use hps_decode::Hps;
use rodio::{OutputStream, Sink};
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// Decode an .hps file into PCM samples for playback
let hps: Hps = std::fs::read("./respect-your-elders.hps")?.try_into()?;
let audio = hps.decode()?;
// Play the song with the rodio library
let (_stream, stream_handle) = OutputStream::try_default()?;
let sink = Sink::try_new(&stream_handle)?;
sink.append(audio);
sink.play();
sink.sleep_until_end();
Ok(())
}
.HPS File Layout
For general purpose, language agnostic documentation of the .hps
file format,
see here.
Re-exports
pub use hps::Hps;
Modules
- Contains
DecodedHps
for iterating over decoded PCM samples. For looping songs, this is an infinite iterator. While an iterator like this is useful for audio playback, you may need to access the samples directly for other kinds of applications. - Contains
Hps
for representing the contents of an.hps
file in a structured format.