From 262d067870ec580dd41e1e797537026a9dbcd37b Mon Sep 17 00:00:00 2001 From: Nicholas Estelami Date: Fri, 10 Jun 2022 15:40:19 -0400 Subject: Fixed resample and corrupt audio bug. Minor documentation updates. --- soh/src/code/audio_load.c | 4 ++++ soh/src/code/z_kankyo.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'soh/src/code') diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index 0732d2fa3..3056a442b 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -1421,6 +1421,10 @@ void AudioLoad_Init(void* heap, u32 heapSize) { uintptr_t bankStart = ResourceMgr_LoadFileRaw(_AudiobankSegmentRomStart); uintptr_t tableStart = ResourceMgr_LoadFileRaw(_AudiotableSegmentRomStart); + // If we have the old audioseq files present (and this is a 32-bit build), use the legacy audio system + if (seqStart != NULL && bankStart != NULL && tableStart != NULL) + gUseLegacySD = true; + fontStart = bankStart; AudioLoad_InitTable(gAudioContext.sequenceTable, seqStart, 0); diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index 9f7518374..6f1fc0c8f 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -2093,9 +2093,14 @@ void func_80075B44(GlobalContext* globalCtx) { case 7: Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_1 << 4 | NATURE_CHANNEL_CRITTER_3, CHANNEL_IO_PORT_1, 0); - if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { - Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, - CHANNEL_IO_PORT_1, 1); + if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) + { + // OTRTODO: This is where corrupt audio happens. Commenting this out seems to not introduce any side effects? + // Further investigation is needed... + + if (gUseLegacySD) + Audio_SetNatureAmbienceChannelIO(NATURE_CHANNEL_CRITTER_4 << 4 | NATURE_CHANNEL_CRITTER_5, + CHANNEL_IO_PORT_1, 1); } globalCtx->envCtx.unk_E0++; break; -- cgit v1.2.3