soundlog
Builder and parser for retro sound-chip register-write logs (VGM)
soundlog is a small Rust crate for constructing and parsing register-write
logs for retro sound chips. It focuses on the VGM (Video Game Music)
file format and provides type-safe APIs for building VGM documents and
representing chip-specific register writes.
Features
- Builder API to construct
VgmDocumentprogrammatically. - Parser to read VGM bytes into a structured
VgmDocument. - Type-safe chip specifications and command types to reduce invalid writes.
Quick start
Builder example
use ;
use ;
use ;
use Gd3;
let mut builder = new;
// Register the chip master clock in the header (Hz)
builder.register_chip;
// Append a chip write using a chip-specific spec
builder.add_chip_write;
builder.add_vgm_command;
builder.set_gd3;
let document: VgmDocument = builder.finalize;
let bytes: = document.into;
Parser example
use ;
use ;
let mut b = new;
b.add_vgm_command;
b.add_vgm_command;
let doc = b.finalize;
let bytes: = .into;
let document: VgmDocument =
.try_into
.expect;
let total_wait: u32 = document
.iter
.map
.sum;
assert_eq!;
Running tests
License
MIT License