From 9ca1a1c1c7bf56e39b516c299b4e0d3efe59652b Mon Sep 17 00:00:00 2001 From: Alexander Kassouni Date: Tue, 8 Sep 2026 20:11:06 -0700 Subject: better docs --- docs/soundfont.html | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'docs/soundfont.html') diff --git a/docs/soundfont.html b/docs/soundfont.html index c07caf9..436071d 100644 --- a/docs/soundfont.html +++ b/docs/soundfont.html @@ -178,11 +178,13 @@ NoteToVoice(vtbl, note) channel.c:354 wtstr { smzwavetable*, tuning } → sample, loop, book, codec, size

ProgToVp is the only consumer of the instrument number, and it is a plain -array index bounded by num_instruments. This is exactly why -you (instrument 118) cannot work on bank 157's 83 instruments: the bounds -check fails, audio_error_flags is set to -0x03000000 + (prog << 8) + inst, and nothing plays — though in practice the -sequence's dynamic table has already clamped the index before it gets there.

+array index bounded by num_instruments: on an out-of-range instrument the +bounds check fails, audio_error_flags is set to +0x03000000 + (prog << 8) + inst, and nothing plays. In retail data the +guard never trips — each sequence's dynamic table only names instruments its own bank +has. In particular you on bank 157 is not an error case: sequence 244 maps +code 0x77 to instrument 82, the last instrument of the bank +(see the disc page).

Every voice instrument uses only the normal slot, so NoteToVoice is a formality here.

@@ -205,7 +207,7 @@ formality here.

119 + 83 + 119 instrument slots — point into that one 4 MB wave bank.

-Field naming. ../extraction.md §2.2 guessed +Field naming. Earlier working notes guessed u8 loaded, rangeLo, rangeHi, releaseRate for the instrument header. The decomp calls them is_relocated, normal_range_low, normal_range_high, adsr_decay_idx. Same layout, and @@ -213,9 +215,9 @@ calls them is_relocated, normal_range_low, the file.
-

Decoding the VADPCM frames themselves is covered in ../extraction.md §2.3 — -including the one easy mistake, which is convolving the decoded outputs instead of the -scaled residuals.

+

Decoding the VADPCM frames themselves is covered on +the disc page — including the one easy mistake, which is +convolving the decoded outputs instead of the scaled residuals.

← 5. Playback -- cgit v1.3.1