Expand description
no_std compatible Cave Story Organya Music Player.
Partially based on bisqwit’s C++ OrgPlay.
§Example
// Basic example for playing Org-02 music with original Cave Story drum sound effects.
use orgorg::{OrgPlay, OrgPlayBuilder, AssetByRef, interp_impls::Linear};
let wavetable: &[u8; 25600] = todo!();
let drum: &[u8; 40000] = todo!();
let org: &[u8] = todo!();
let mut player: OrgPlay<'_, Linear, AssetByRef<'_>> = OrgPlayBuilder::new()
.with_sample_rate(44100)
.with_interpolation(Linear)
.with_asset(wavetable, drum) // Lifetime of them is now tied to AssetByRef<'_>
.build(org) // Lifetime of `org` is now tied to OrgPlay<'_, ..>
.expect("Invalid organya music");
let mut buffer = [0.0_f32; 1024];
loop {
player.synth_stereo(&mut buffer);
// Process buffer and output
}For owned OrgPlay, use self-referential struct helpers like
self_cell or ouroboros.
See orgorg-player for example.
§How to get data needed for synthesis
See orgorg-player project.
Run orgorg-player dump for Cave Story wavetable and drums.
And see wdb
module in orgorg-player for loading soundbank.wdb.
§Performance
It is fast and does not allocate memory at all. But with following caveats.
- FPU should be present for maximum performance, since there are lots of single-precision(f32) floating point arithmetic.
- This crate uses some unsafe to boost the performance. The author tried to ensure correctness but, who knows. Feel free to audit the code.
Modules§
- interp_
impls - Builtin
OrgInterpolationimplementations.
Structs§
- Asset
ByRef - Default provider used in
OrgPlayBuilder::with_asset - OrgPlay
no_stdcompatible Cave Story Organya Music Player.- OrgPlay
Builder - Builder for
OrgPlay. - Soundbank
- Custom soundbank by ref.
Traits§
- Cave
Story Asset Provider - Provides original Cave Story wavetable and drum samples to
OrgPlay. - OrgInterpolation
- Interpolation for Organya Music synthesis.
- Soundbank
Provider - Provides wavetable and drum samples to
OrgPlay.