mirror of
https://github.com/RetroPortingToolKit/psxrecomp
synced 2026-10-26 18:25:35 -04:00
537b4e182d
The ADPCM start and repeat address registers count 8-byte units, but hardware ignores bit0 — a voice's block fetch is always 16-byte aligned. DuckStation implements exactly this (Voice::KeyOn, adpcm_start_address & ~1u, and the same masking on the repeat-address jump); Beetle aligns identically. psx-spx documents the 8-byte units and is silent on the low bit. Honoring the raw bit makes a voice keyed at an odd 8-unit address decode from mid-block: sample bytes get parsed as headers, typically hitting a spurious END+REPEAT within a few blocks. Twisted Metal III (SCUS-94249) depends on the alignment — its sound-bank tables produce odd start addresses (samples are packed at 8-byte granularity) whose real streams begin at the aligned twin. Unaligned, its explosion one-shots collapsed into ~10 ms looping blips; offline ADPCM decode of the aligned twin recovers the full 1.3 s sample, and in-game audio matches a reference emulator after the fix. Masked at the two intake points: the KEYON latch of the current and repeat addresses, and the live repeat-register write.