Play the music and sound effects from the ROM's sound engine (Closes #34)
The sound engine (audio/engine.asm, home/audio.asm) is ported on a byte copy of its audio WRAM and a sound register model. A reference test runs the cartridge's routines beside it and matches the WRAM and registers after every UpdateSound for all songs, effects and cries, fades, the danger tone and effect priority. apu.ts synthesizes the four channels in an AudioWorklet; its output matches the reference emulator's APU by spectrum. The world runs the engine twice per tick; Play or the first press unlocks sound, pausing suspends it, Settings sets the volume. Wired in: map music by map setup and special map music, script audio commands, text fanfares, WaitSFX and cries that hold the script frozen (the last page stays shown), battle music, cries, fainting, victory, capture and the low HP tone, Pokémon Center healing, evolution, the intro, the Pokédex's cries, PCs, marts, healing items, talk and menu clicks, bumps, ledges, warps, boulders, the Bicycle and Surf. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aff8391e55
commit
7f30c3f450
34 files changed
+3961
-74
No files matched your search
@@ -130,6 +130,7 @@ export class CrystalAssets {
|
||||
environment: r.byte(header + 2),
|
||||
paletteMode: r.byte(header + 7) & 15,
|
||||
phoneService: r.byte(header + 7) >> 4,
|
||||
music: r.byte(header + 6),
|
||||
fishGroup: r.byte(header + 8),
|
||||
attributes,
|
||||
blocks: r.slice(r.far(attributes + 3), blockWidth * blockHeight),
|
||||
|
||||
@@ -209,6 +209,8 @@ export const ENGINE_FLAGS = {
|
||||
allFruitTrees: 84,
|
||||
/** STATUSFLAGS2_BUG_CONTEST_TIMER_F is the same WRAM bit. */
|
||||
bugContestTimer: 17,
|
||||
rocketsInRadioTower: 19,
|
||||
rocketsInMahogany: 23,
|
||||
} as const;
|
||||
|
||||
/** Overworld scripts, routines and tables, keyed by their PRET labels so
|
||||
@@ -1063,6 +1065,20 @@ export const OPTIONS = {
|
||||
"Options_MenuAccount.On": 0xe44f6,
|
||||
} as const;
|
||||
|
||||
/** The sound engine (audio/engine.asm) and its tables, keyed by their
|
||||
* PRET labels. */
|
||||
export const AUDIO = {
|
||||
_UpdateSound: 0xe805c,
|
||||
FrequencyTable: 0xe8d80,
|
||||
WaveSamples: 0xe8db2,
|
||||
Drumkits: 0xe8e52,
|
||||
TrainerEncounterMusic: 0xe9027,
|
||||
Music: 0xe906e,
|
||||
Cries: 0xe91b0,
|
||||
SFX: 0xe927c,
|
||||
PokemonCries: 0xf2787,
|
||||
} as const;
|
||||
|
||||
/** Johto's scripts, routines and tables from Route 32 on, keyed by their
|
||||
* PRET labels for `npm run check:reference`. */
|
||||
export const JOHTO = {
|
||||
|
||||
Reference in new issue
Block a user