diff options
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/code_800E4FE0.c | 8 | ||||
| -rw-r--r-- | src/code/code_800EC960.c | 370 | ||||
| -rw-r--r-- | src/code/code_800F7260.c | 29 | ||||
| -rw-r--r-- | src/code/code_800F9280.c | 204 | ||||
| -rw-r--r-- | src/code/z_demo.c | 4 | ||||
| -rw-r--r-- | src/code/z_kankyo.c | 6 |
6 files changed, 317 insertions, 304 deletions
diff --git a/src/code/code_800E4FE0.c b/src/code/code_800E4FE0.c index 102012fa7..8a1ed54b1 100644 --- a/src/code/code_800E4FE0.c +++ b/src/code/code_800E4FE0.c @@ -562,8 +562,8 @@ s8 func_800E6070(s32 playerIdx, s32 channelIdx, s32 scriptIdx) { } } -s8 func_800E60C4(s32 arg0, s32 arg1) { - return gAudioContext.seqPlayers[arg0].soundScriptIO[arg1]; +s8 func_800E60C4(s32 playerIdx, s32 arg1) { + return gAudioContext.seqPlayers[playerIdx].soundScriptIO[arg1]; } void Audio_InitExternalPool(void* mem, u32 size) { @@ -723,7 +723,7 @@ void Audio_WaitForAudioTask(void) { osRecvMesg(gAudioContext.taskStartQueueP, NULL, OS_MESG_BLOCK); } -s32 func_800E6590(s32 arg0, s32 arg1, s32 arg2) { +s32 func_800E6590(s32 playerIdx, s32 arg1, s32 arg2) { SequencePlayer* seqPlayer; SequenceLayer* layer; Note* note; @@ -731,7 +731,7 @@ s32 func_800E6590(s32 arg0, s32 arg1, s32 arg2) { s32 loopEnd; s32 samplePos; - seqPlayer = &gAudioContext.seqPlayers[arg0]; + seqPlayer = &gAudioContext.seqPlayers[playerIdx]; if (seqPlayer->enabled && seqPlayer->channels[arg1]->enabled) { layer = seqPlayer->channels[arg1]->layers[arg2]; if (layer == NULL) { diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c index 875b47d89..2088716d6 100644 --- a/src/code/code_800EC960.c +++ b/src/code/code_800EC960.c @@ -966,15 +966,15 @@ void func_800ED458(s32 arg0) { D_80130F24 = Audio_OcaAdjStick(D_80130F2C); D_80130F34 = (sCurOcaStick.x < 0 ? -sCurOcaStick.x : sCurOcaStick.x) >> 2; - Audio_QueueCmdS8(0x6020D06, D_80130F34); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, D_80130F34); } else { D_80130F2C = 0; D_80130F24 = 1.0f; } if ((sCurOcarinaBtnVal != 0xFF) && (sPrevOcarinaNoteVal != sCurOcarinaBtnVal)) { - Audio_QueueCmdS8(0x6020D07, D_80130F10 - 1); - Audio_QueueCmdS8(0x6020D05, sCurOcarinaBtnVal); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sCurOcarinaBtnVal); Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &D_801333D4, 4, &D_80130F24, &D_80130F28, &D_801333E8); } else if ((sPrevOcarinaNoteVal != 0xFF) && (sCurOcarinaBtnVal == 0xFF)) { Audio_StopSfxById(NA_SE_OC_OCARINA); @@ -991,7 +991,7 @@ void Audio_OcaSetInstrument(u8 arg0) { return; } - Audio_SeqCmd8(2, 1, SFX_PLAYER_CHANNEL_OCARINA, arg0); + Audio_SeqCmd8(SEQ_PLAYER_SFX, 1, SFX_PLAYER_CHANNEL_OCARINA, arg0); D_80130F10 = arg0; if (arg0 == 0) { sCurOcarinaBtnPress = 0; @@ -1084,7 +1084,7 @@ void Audio_OcaPlayback(void) { if (sNotePlaybackVibrato != sPlaybackSong[sPlaybackNotePos].vibrato) { sNotePlaybackVibrato = sPlaybackSong[sPlaybackNotePos].vibrato; - Audio_QueueCmdS8(0x06020D06, sNotePlaybackVibrato); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD06, sNotePlaybackVibrato); } if (sNotePlaybackTone != sPlaybackSong[sPlaybackNotePos].tone) { @@ -1108,8 +1108,8 @@ void Audio_OcaPlayback(void) { if (sDisplayedNoteValue != 0xFF) { sStaffPlaybackPos++; - Audio_QueueCmdS8(0x6020D07, D_80130F10 - 1); - Audio_QueueCmdS8(0x6020D05, sDisplayedNoteValue & 0x3F); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD07, D_80130F10 - 1); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | 0xD05, sDisplayedNoteValue & 0x3F); Audio_PlaySoundGeneral(NA_SE_OC_OCARINA, &D_801333D4, 4, &sNormalizedNotePlaybackTone, &sNormalizedNotePlaybackVolume, &D_801333E8); } else { @@ -1528,7 +1528,7 @@ char sAudioSfxSwapModeNames[2][5] = { "SWAP", "ADD" }; u8 sAudioSfxParamChgSel = 0; u8 sAudioSfxParamChgBitSel = 0; u16 sAudioSfxParamChgWork[4] = { 0 }; -u8 sAudioSubTrackInfoPlayerSel = 0; +u8 sAudioSubTrackInfoPlayerSel = SEQ_PLAYER_BGM_MAIN; u8 sAudioSubTrackInfoChannelSel = 0; u8 sSeqPlayerPeakNumLayers[20] = { 0 }; char sAudioSceneNames[3][2] = { "A", "S", "X" }; @@ -1716,7 +1716,7 @@ void AudioDebug_Draw(GfxPrint* printer) { for (k2 = 0; k2 < gChannelsPerBank[gSfxChannelLayout][k]; k2++) { #define entryIndex (gActiveSounds[k][k2].entryIndex) #define entry (&gSoundBanks[k][entryIndex]) -#define chan (gAudioContext.seqPlayers[2].channels[entry->channelIdx]) +#define chan (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[entry->channelIdx]) GfxPrint_SetPos(printer, 2 + sAudioIntInfoX, 5 + ind + sAudioIntInfoY); if (sAudioIntInfoBankPage[k] == 1) { if ((entryIndex != 0xFF) && @@ -2101,30 +2101,35 @@ void AudioDebug_Draw(GfxPrint* printer) { SETCOL(255, 255, 255); GfxPrint_SetPos(printer, 3, 7); - GfxPrint_Printf(printer, "NEXT SCENE %02X %s", (u8)gAudioContext.seqPlayers[0].soundScriptIO[2], - sAudioSceneNames[(u8)gAudioContext.seqPlayers[0].soundScriptIO[2]]); + GfxPrint_Printf(printer, "NEXT SCENE %02X %s", + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2], + sAudioSceneNames[(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2]]); GfxPrint_SetPos(printer, 3, 8); - GfxPrint_Printf(printer, "NOW SCENE %02X %s", (u8)gAudioContext.seqPlayers[0].soundScriptIO[4], - sAudioSceneNames[(u8)gAudioContext.seqPlayers[0].soundScriptIO[4]]); + GfxPrint_Printf(printer, "NOW SCENE %02X %s", + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4], + sAudioSceneNames[(u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4]]); GfxPrint_SetPos(printer, 3, 9); - GfxPrint_Printf(printer, "NOW BLOCK %02X", (gAudioContext.seqPlayers[0].soundScriptIO[5] + 1) & 0xFF); + GfxPrint_Printf(printer, "NOW BLOCK %02X", + (gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5] + 1) & 0xFF); GfxPrint_SetPos(printer, 3, 11); GfxPrint_Printf(printer, "PORT"); GfxPrint_SetPos(printer, 3, 12); - GfxPrint_Printf(printer, "%02X %02X %02X %02X", (u8)gAudioContext.seqPlayers[0].soundScriptIO[0], - (u8)gAudioContext.seqPlayers[0].soundScriptIO[1], - (u8)gAudioContext.seqPlayers[0].soundScriptIO[2], - (u8)gAudioContext.seqPlayers[0].soundScriptIO[3]); + GfxPrint_Printf(printer, "%02X %02X %02X %02X", + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[0], + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[1], + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[2], + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]); GfxPrint_SetPos(printer, 3, 13); - GfxPrint_Printf(printer, "%02X %02X %02X %02X", (u8)gAudioContext.seqPlayers[0].soundScriptIO[4], - (u8)gAudioContext.seqPlayers[0].soundScriptIO[5], - (u8)gAudioContext.seqPlayers[0].soundScriptIO[6], - (u8)gAudioContext.seqPlayers[0].soundScriptIO[7]); + GfxPrint_Printf(printer, "%02X %02X %02X %02X", + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[4], + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[5], + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[6], + (u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[7]); break; case PAGE_OCARINA_TEST: @@ -2329,10 +2334,10 @@ void AudioDebug_ProcessInput_SndCont(void) { func_800F6700(sAudioSndContWork[sAudioSndContSel]); break; case 5: - Audio_SeqCmdE01(0, sAudioSndContWork[sAudioSndContSel]); + Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[sAudioSndContSel]); break; case 6: - Audio_SeqCmdF(0, sAudioSndContWork[sAudioSndContSel]); + Audio_SeqCmdF(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[sAudioSndContSel]); sAudioSubTrackInfoSpec = sAudioSndContWork[6]; if (sAudioSubTrackInfoPlayerSel > gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1) { sAudioSubTrackInfoPlayerSel = gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1; @@ -2357,7 +2362,7 @@ void AudioDebug_ProcessInput_SndCont(void) { Audio_SeqCmd1(sAudioSndContSel, 0); break; case 7: - Audio_SeqCmd1(0, 0); + Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0); break; case 2: case 3: @@ -2596,7 +2601,7 @@ void AudioDebug_ProcessInput_SubTrackInfo(void) { if (sAudioSubTrackInfoPlayerSel < gAudioSpecs[sAudioSubTrackInfoSpec].numSequencePlayers - 1) { sAudioSubTrackInfoPlayerSel++; } else { - sAudioSubTrackInfoPlayerSel = 0; + sAudioSubTrackInfoPlayerSel = SEQ_PLAYER_BGM_MAIN; } } if (CHECK_BTN_ANY(sDebugPadPress, BTN_DLEFT)) { @@ -2606,7 +2611,7 @@ void AudioDebug_ProcessInput_SubTrackInfo(void) { sAudioSubTrackInfoChannelSel = (sAudioSubTrackInfoChannelSel + 1) & 0xF; } if (CHECK_BTN_ANY(sDebugPadPress, BTN_START)) { - sSeqPlayerPeakNumLayers[sAudioSubTrackInfoPlayerSel] = 0; + sSeqPlayerPeakNumLayers[sAudioSubTrackInfoPlayerSel] = SEQ_PLAYER_BGM_MAIN; } } @@ -2646,7 +2651,7 @@ void AudioDebug_ProcessInput_BlkChgBgm(void) { } if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) { - Audio_QueueCmdS8(MK_CMD(0x46, 0x00, 0x00, 0x00), sAudioBlkChgBgmWork[1]); + Audio_QueueCmdS8(MK_CMD(0x46, SEQ_PLAYER_BGM_MAIN, 0x00, 0x00), sAudioBlkChgBgmWork[1]); Audio_QueueSeqCmd(sAudioBlkChgBgmWork[0] | 0x10000); } @@ -2802,12 +2807,12 @@ void AudioDebug_ProcessInput(void) { case PAGE_NON: if (CHECK_BTN_ANY(sDebugPadPress, BTN_A)) { sAudioSndContWork[5] ^= 1; - Audio_SeqCmdE01(0, sAudioSndContWork[5]); - if (func_800FA0B4(0) != NA_BGM_NATURE_BACKGROUND) { - Audio_SeqCmd1(0, 0); + Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, sAudioSndContWork[5]); + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_NATURE_BACKGROUND) { + Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0); } - Audio_SeqCmd1(1, 0); - Audio_SeqCmd1(3, 0); + Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0); + Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, 0); } if (CHECK_BTN_ANY(sDebugPadPress, BTN_B)) { @@ -2887,7 +2892,7 @@ void func_800F3140(UNK_TYPE arg0, UNK_TYPE arg1) { } void func_800F314C(s8 arg0) { - Audio_QueueCmdS32(0x82000000 | (((u8)arg0 & 0xFF) << 8), 1); + Audio_QueueCmdS32(0x82 << 24 | SEQ_PLAYER_BGM_MAIN << 16 | (((u8)arg0 & 0xFF) << 8), 1); } f32 Audio_ComputeSoundVolume(u8 bankId, u8 entryIdx) { @@ -2949,9 +2954,9 @@ s8 Audio_ComputeSoundReverb(u8 bankId, u8 entryIdx, u8 channelIdx) { } } - if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[2].channels[channelIdx])) { - scriptAdd = gAudioContext.seqPlayers[2].channels[channelIdx]->soundScriptIO[1]; - if (gAudioContext.seqPlayers[2].channels[channelIdx]->soundScriptIO[1] < 0) { + if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx])) { + scriptAdd = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1]; + if (gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[channelIdx]->soundScriptIO[1] < 0) { scriptAdd = 0; } } @@ -3195,33 +3200,33 @@ void Audio_SetSoundProperties(u8 bankId, u8 entryIdx, u8 channelIdx) { } // CHAN_UPD_SCRIPT_IO (slot 2, sets volume) - Audio_QueueCmdS8(0x6020000 | (channelIdx << 8) | 2, volS8); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8) | 2, volS8); if (reverb != sSfxChannelState[channelIdx].reverb) { - Audio_QueueCmdS8(0x5020000 | (channelIdx << 8), reverb); + Audio_QueueCmdS8(0x5 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), reverb); sSfxChannelState[channelIdx].reverb = reverb; } if (freqScale != sSfxChannelState[channelIdx].freqScale) { - Audio_QueueCmdF32(0x4020000 | (channelIdx << 8), freqScale); + Audio_QueueCmdF32(0x4 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), freqScale); sSfxChannelState[channelIdx].freqScale = freqScale; } if (stereoBits != sSfxChannelState[channelIdx].stereoBits) { - Audio_QueueCmdS8(0xE020000 | (channelIdx << 8), stereoBits | 0x10); + Audio_QueueCmdS8(0xE << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), stereoBits | 0x10); sSfxChannelState[channelIdx].stereoBits = stereoBits; } if (filter != sSfxChannelState[channelIdx].filter) { // CHAN_UPD_SCRIPT_IO (slot 3, sets filter) - Audio_QueueCmdS8(0x6020000 | (channelIdx << 8) | 3, filter); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8) | 3, filter); sSfxChannelState[channelIdx].filter = filter; } if (sp38 != sSfxChannelState[channelIdx].unk_0C) { // CHAN_UPD_UNK_0F - Audio_QueueCmdS8(0xC020000 | (channelIdx << 8), 0x10); + Audio_QueueCmdS8(0xC << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), 0x10); // CHAN_UPD_UNK_20 - Audio_QueueCmdU16(0xD020000 | (channelIdx << 8), ((u16)(sp38) << 8) + 0xFF); + Audio_QueueCmdU16(0xD << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), ((u16)(sp38) << 8) + 0xFF); sSfxChannelState[channelIdx].unk_0C = sp38; } if (panSigned != sSfxChannelState[channelIdx].panSigned) { - Audio_QueueCmdS8(0x3020000 | (channelIdx << 8), panSigned); + Audio_QueueCmdS8(0x3 << 24 | SEQ_PLAYER_SFX << 16 | (channelIdx << 8), panSigned); sSfxChannelState[channelIdx].panSigned = panSigned; } } @@ -3248,8 +3253,8 @@ void Audio_ResetSfxChannelState(void) { void func_800F3F3C(u8 arg0) { if (gSoundBankMuted[0] != 1) { - Audio_StartSeq(3, 0, NA_BGM_VARIOUS_SFX); - Audio_SeqCmd8(3, 0, 0, arg0); + Audio_StartSeq(SEQ_PLAYER_BGM_SUB, 0, NA_BGM_VARIOUS_SFX); + Audio_SeqCmd8(SEQ_PLAYER_BGM_SUB, 0, 0, arg0); } } @@ -3413,17 +3418,17 @@ void Audio_StepFreqLerp(FreqLerp* lerp) { } void func_800F47BC(void) { - Audio_SetVolScale(0, 1, 0, 10); - Audio_SetVolScale(3, 1, 0, 10); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 1, 0, 10); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 1, 0, 10); } void func_800F47FC(void) { - Audio_SetVolScale(0, 1, 0x7F, 3); - Audio_SetVolScale(3, 1, 0x7F, 3); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 1, 0x7F, 3); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 1, 0x7F, 3); } void func_800F483C(u8 targetVol, u8 volFadeTimer) { - Audio_SetVolScale(0, 0, targetVol, volFadeTimer); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 0, targetVol, volFadeTimer); } void func_800F4870(u8 arg0) { @@ -3437,7 +3442,8 @@ void func_800F4870(u8 arg0) { for (i = 0; i < 16; i++) { // CHAN_UPD_PAN_UNSIGNED - Audio_QueueCmdS8(_SHIFTL(0x07, 24, 8) | _SHIFTL(0x00, 16, 8) | _SHIFTL(i, 8, 8) | _SHIFTL(0, 0, 8), pan); + Audio_QueueCmdS8( + _SHIFTL(0x7, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | _SHIFTL(i, 8, 8) | _SHIFTL(0, 0, 8), pan); } if (arg0 == 7) { @@ -3454,24 +3460,27 @@ s32 Audio_SetGanonDistVol(u8 targetVol) { u8 i; if (sAudioGanonDistVol != targetVol) { - Audio_SetVolScale(0, 0, targetVol, 2); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 0, targetVol, 2); if (targetVol < 0x40) { phi_v0 = 0x10; } else { phi_v0 = (((targetVol - 0x40) >> 2) + 1) << 4; } - Audio_SeqCmd8(0, 4, 15, phi_v0); + Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 4, 15, phi_v0); for (i = 0; i < 0x10; i++) { - if (gAudioContext.seqPlayers[0].channels[i] != &gAudioContext.sequenceChannelNone) { - if ((u8)gAudioContext.seqPlayers[0].channels[i]->soundScriptIO[5] != 0xFF) { + if (gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[i] != &gAudioContext.sequenceChannelNone) { + if ((u8)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[i]->soundScriptIO[5] != 0xFF) { // this looks like some kind of macro? - phi_v0_2 = ((u16)gAudioContext.seqPlayers[0].channels[i]->soundScriptIO[5] - targetVol) + 0x7F; + phi_v0_2 = + ((u16)gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].channels[i]->soundScriptIO[5] - targetVol) + + 0x7F; if (phi_v0_2 >= 0x80) { phi_v0_2 = 0x7F; } // CHAN_UPD_REVERB - Audio_QueueCmdS8(_SHIFTL(5, 24, 8) | _SHIFTL(0, 16, 8) | _SHIFTL(i, 8, 8) | _SHIFTL(0, 0, 8), + Audio_QueueCmdS8(_SHIFTL(0x5, 24, 8) | _SHIFTL(SEQ_PLAYER_BGM_MAIN, 16, 8) | _SHIFTL(i, 8, 8) | + _SHIFTL(0, 0, 8), (u8)phi_v0_2); } } @@ -3489,13 +3498,13 @@ void func_800F4A54(u8 arg0) { void func_800F4A70(void) { if (D_8016B8B2 == 1) { if (D_8016B8B1 != D_8016B8B0) { - Audio_SetVolScale(0, 0, D_8016B8B0, 0xA); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 0, D_8016B8B0, 0xA); D_8016B8B1 = D_8016B8B0; D_8016B8B3 = 1; } D_8016B8B2 = 0; } else if (D_8016B8B3 == 1 && D_80130608 == 0) { - Audio_SetVolScale(0, 0, 0x7F, 0xA); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 0xA); D_8016B8B1 = 0x7F; D_8016B8B3 = 0; } @@ -3538,7 +3547,8 @@ void func_800F4C58(Vec3f* pos, u16 sfxId, u8 arg2) { for (i = 0; i < gChannelsPerBank[gSfxChannelLayout][bankId]; i++) { if ((gActiveSounds[bankId][i].entryIndex != 0xFF) && (sfxId == gSoundBanks[bankId][gActiveSounds[bankId][i].entryIndex].sfxId)) { - Audio_QueueCmdS8(_SHIFTL(6, 24, 8) | _SHIFTL(2, 16, 8) | _SHIFTL(phi_s1, 8, 8) | _SHIFTL(6, 0, 8), arg2); + Audio_QueueCmdS8( + _SHIFTL(0x6, 24, 8) | _SHIFTL(SEQ_PLAYER_SFX, 16, 8) | _SHIFTL(phi_s1, 8, 8) | _SHIFTL(6, 0, 8), arg2); } phi_s1++; } @@ -3580,8 +3590,8 @@ void func_800F4E30(Vec3f* pos, f32 arg1) { for (i = 0; i < 0x10; i++) { if (i != 9) { - Audio_SeqCmd6(0, 2, i, (127.0f * phi_f22)); - Audio_QueueCmdS8(0x03000000 | ((u8)((u32)i) << 8), phi_s4); + Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 2, i, (127.0f * phi_f22)); + Audio_QueueCmdS8(0x3 << 24 | SEQ_PLAYER_BGM_MAIN << 16 | ((u8)((u32)i) << 8), phi_s4); } } } @@ -3602,11 +3612,12 @@ void func_800F510C(s8 volSplit) { u8 vol; u8 prio; u16 channelBits; - u8 players[2] = { 0, 3 }; + u8 players[2] = { SEQ_PLAYER_BGM_MAIN, SEQ_PLAYER_BGM_SUB }; u8 i; u8 j; - if ((func_800FA0B4(1) == NA_BGM_DISABLED) && (func_800FA0B4(3) != NA_BGM_LONLON)) { + if ((func_800FA0B4(SEQ_PLAYER_FANFARE) == NA_BGM_DISABLED) && + (func_800FA0B4(SEQ_PLAYER_BGM_SUB) != NA_BGM_LONLON)) { for (i = 0; i < 2; i++) { if (i == 0) { vol = volSplit; @@ -3648,7 +3659,7 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) { dist = sqrtf(SQ(pos->z) + SQ(pos->x)); if (sSariaBgmPtr == NULL) { sSariaBgmPtr = pos; - func_800F5E18(3, seqId, 0, 7, 2); + func_800F5E18(SEQ_PLAYER_BGM_SUB, seqId, 0, 7, 2); } else { prevDist = sqrtf(SQ(sSariaBgmPtr->z) + SQ(sSariaBgmPtr->x)); if (dist < prevDist) { @@ -3676,8 +3687,8 @@ void Audio_PlaySariaBgm(Vec3f* pos, u16 seqId, u16 distMax) { func_800F510C(vol); } - Audio_SetVolScale(3, 3, vol, 0); - Audio_SetVolScale(0, 3, 0x7F - vol, 0); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 3, vol, 0); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F - vol, 0); } void Audio_ClearSariaBgm2(void) { @@ -3686,16 +3697,16 @@ void Audio_ClearSariaBgm2(void) { void func_800F5510(u16 seqId) { func_800F5550(seqId); - func_800F5E18(0, seqId, 0, 0, 1); + func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 0, 1); } void func_800F5550(u16 seqId) { u8 sp27 = 0; u16 nv; - if (func_800FA0B4(0) != NA_BGM_WINDMILL) { - if (func_800FA0B4(3) == NA_BGM_LONLON) { - func_800F9474(3, 0); + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) { + if (func_800FA0B4(SEQ_PLAYER_BGM_SUB) == NA_BGM_LONLON) { + func_800F9474(SEQ_PLAYER_BGM_SUB, 0); Audio_QueueCmdS32(0xF8000000, 0); } @@ -3705,12 +3716,12 @@ void func_800F5550(u16 seqId) { sp27 = 0x1E; } - func_800F5E18(0, seqId, sp27, 7, D_8013062C); + func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, sp27, 7, D_8013062C); D_8013062C = 0; } else { nv = (D_80130658[(seqId & 0xFF) & 0xFF] & 0x40) ? 1 : 0xFF; - func_800F5E18(0, seqId, 0, 7, nv); + func_800F5E18(SEQ_PLAYER_BGM_MAIN, seqId, 0, 7, nv); if (!(D_80130658[seqId] & 0x20)) { D_8013062C = 0xC0; } @@ -3723,11 +3734,11 @@ void func_800F56A8(void) { u16 temp_v0; u8 bvar; - temp_v0 = func_800FA0B4(0); + temp_v0 = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); bvar = temp_v0 & 0xFF; if ((temp_v0 != NA_BGM_DISABLED) && ((D_80130658[bvar] & 0x10) != 0)) { if (D_8013062C != 0xC0) { - D_8013062C = gAudioContext.seqPlayers->soundScriptIO[3]; + D_8013062C = gAudioContext.seqPlayers[SEQ_PLAYER_BGM_MAIN].soundScriptIO[3]; } else { D_8013062C = 0; } @@ -3735,23 +3746,23 @@ void func_800F56A8(void) { } void func_800F5718(void) { - if (func_800FA0B4(0) != NA_BGM_WINDMILL) { - Audio_StartSeq(0, 0, NA_BGM_WINDMILL); + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_WINDMILL) { + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_WINDMILL); } } void func_800F574C(f32 arg0, u8 arg2) { if (arg0 == 1.0f) { - Audio_SeqCmdB40(0, arg2, 0); + Audio_SeqCmdB40(SEQ_PLAYER_BGM_MAIN, arg2, 0); } else { - Audio_SeqCmdC(1, 0x30, arg2, arg0 * 100.0f); + Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x30, arg2, arg0 * 100.0f); } - Audio_SeqCmdC(1, 0xA0, arg2, arg0 * 100.0f); + Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0xA0, arg2, arg0 * 100.0f); } void func_800F5918(void) { - if (func_800FA0B4(0) == NA_BGM_MINI_GAME_2 && func_800FA11C(0, 0xF0000000)) { - Audio_SeqCmdB(0, 5, 0, 0xD2); + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_MINI_GAME_2 && func_800FA11C(0, 0xF0000000)) { + Audio_SeqCmdB(SEQ_PLAYER_BGM_MAIN, 5, 0, 0xD2); } } @@ -3761,11 +3772,11 @@ void func_800F595C(u16 arg0) { if (D_80130658[arg0b] & 2) { Audio_PlayFanfare(arg0); } else if (D_80130658[arg0b] & 4) { - Audio_StartSeq(1, 0, arg0); + Audio_StartSeq(SEQ_PLAYER_FANFARE, 0, arg0); } else { - func_800F5E18(0, arg0, 0, 7, -1); - Audio_SeqCmd1(1, 0); + func_800F5E18(SEQ_PLAYER_BGM_MAIN, arg0, 0, 7, -1); + Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0); } } @@ -3773,11 +3784,11 @@ void func_800F59E8(u16 arg0) { u8 arg0b = arg0 & 0xFF; if (D_80130658[arg0b] & 2) { - Audio_SeqCmd1(1, 0); + Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0); } else if (D_80130658[arg0b] & 4) { - Audio_SeqCmd1(1, 0); + Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0); } else { - Audio_SeqCmd1(0, 0); + Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0); } } @@ -3800,7 +3811,7 @@ s32 func_800F5A58(u8 arg0) { void func_800F5ACC(u16 seqId) { u16 temp_v0; - temp_v0 = func_800FA0B4(0); + temp_v0 = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); if ((temp_v0 & 0xFF) != NA_BGM_GANON_TOWER && (temp_v0 & 0xFF) != NA_BGM_ESCAPE && temp_v0 != seqId) { func_800F5E90(3); if (temp_v0 != NA_BGM_DISABLED) { @@ -3808,17 +3819,17 @@ void func_800F5ACC(u16 seqId) { } else { osSyncPrintf("Middle Boss BGM Start not stack \n"); } - Audio_StartSeq(0, 0, seqId); + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, seqId); } } void func_800F5B58(void) { - if ((func_800FA0B4(0) != NA_BGM_DISABLED) && (D_80130628 != NA_BGM_DISABLED) && - (D_80130658[func_800FA0B4(0) & 0xFF] & 8)) { + if ((func_800FA0B4(SEQ_PLAYER_BGM_MAIN) != NA_BGM_DISABLED) && (D_80130628 != NA_BGM_DISABLED) && + (D_80130658[func_800FA0B4(SEQ_PLAYER_BGM_MAIN) & 0xFF] & 8)) { if (D_80130628 == NA_BGM_DISABLED) { - Audio_SeqCmd1(0, 0); + Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, 0); } else { - Audio_StartSeq(0, 0, D_80130628); + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, D_80130628); } D_80130628 = NA_BGM_DISABLED; } @@ -3827,7 +3838,7 @@ void func_800F5B58(void) { void func_800F5BF0(u8 arg0) { u16 temp_v0; - temp_v0 = func_800FA0B4(0); + temp_v0 = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); if (temp_v0 != NA_BGM_NATURE_BACKGROUND) { D_80130628 = temp_v0; } @@ -3836,7 +3847,7 @@ void func_800F5BF0(u8 arg0) { void func_800F5C2C(void) { if (D_80130628 != NA_BGM_DISABLED) { - Audio_StartSeq(0, 0, D_80130628); + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, D_80130628); } D_80130628 = NA_BGM_DISABLED; } @@ -3847,14 +3858,14 @@ void Audio_PlayFanfare(u16 seqId) { u8* sp1C; u8* sp18; - sp26 = func_800FA0B4(1); + sp26 = func_800FA0B4(SEQ_PLAYER_FANFARE); sp1C = func_800E5E84(sp26 & 0xFF, &sp20); sp18 = func_800E5E84(seqId & 0xFF, &sp20); if ((sp26 == NA_BGM_DISABLED) || (*sp1C == *sp18)) { D_8016B9F4 = 1; } else { D_8016B9F4 = 5; - Audio_SeqCmd1(1, 0); + Audio_SeqCmd1(SEQ_PLAYER_FANFARE, 0); } D_8016B9F6 = seqId; } @@ -3869,23 +3880,23 @@ void func_800F5CF8(void) { if (D_8016B9F4 == 0) { Audio_QueueCmdS32(0xE3000000, SEQUENCE_TABLE); Audio_QueueCmdS32(0xE3000000, FONT_TABLE); - func_800FA0B4(0); - sp26 = func_800FA0B4(1); - sp22 = func_800FA0B4(3); + func_800FA0B4(SEQ_PLAYER_BGM_MAIN); + sp26 = func_800FA0B4(SEQ_PLAYER_FANFARE); + sp22 = func_800FA0B4(SEQ_PLAYER_BGM_SUB); if (sp26 == NA_BGM_DISABLED) { - Audio_SetVolScale(0, 1, 0, 5); - Audio_SetVolScale(3, 1, 0, 5); - Audio_SeqCmdC(1, 0x80, 1, 0xA); - Audio_SeqCmdC(1, 0x83, 1, 0xA); - Audio_SeqCmdC(1, 0x90, 0, 0); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 1, 0, 5); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 1, 0, 5); + Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x80, 1, 0xA); + Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x83, 1, 0xA); + Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x90, 0, 0); if (sp22 != NA_BGM_LONLON) { - Audio_SeqCmdC(1, 0x93, 0, 0); + Audio_SeqCmdC(SEQ_PLAYER_FANFARE, 0x93, 0, 0); } } - Audio_StartSeq(1, 1, D_8016B9F6); + Audio_StartSeq(SEQ_PLAYER_FANFARE, 1, D_8016B9F6); Audio_SeqCmdA(0, 0xFFFF); if (sp22 != NA_BGM_LONLON) { - Audio_SeqCmdA(3, 0xFFFF); + Audio_SeqCmdA(SEQ_PLAYER_BGM_SUB, 0xFFFF); } } } @@ -3906,8 +3917,8 @@ void func_800F5E90(u8 arg0) { if (sAudioCutsceneFlag) { arg0 = 3; } - phi_t1 = D_8016E750[0].unk_254; - if (phi_t1 == NA_BGM_FIELD_LOGIC && func_800FA0B4(3) == (NA_BGM_ENEMY | 0x800)) { + phi_t1 = D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254; + if (phi_t1 == NA_BGM_FIELD_LOGIC && func_800FA0B4(SEQ_PLAYER_BGM_SUB) == (NA_BGM_ENEMY | 0x800)) { arg0 = 3; } @@ -3915,27 +3926,27 @@ void func_800F5E90(u8 arg0) { if ((phi_t1 == NA_BGM_DISABLED) || ((D_80130658[phi_a3] & 1) != 0) || ((D_8013061C & 0x7F) == 1)) { if (arg0 != (D_8013061C & 0x7F)) { if (arg0 == 1) { - if (D_8016E750[3].volScales[1] - sAudioEnemyVol < 0) { - phi_t0 = -(D_8016E750[3].volScales[1] - sAudioEnemyVol); + if (D_8016E750[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol < 0) { + phi_t0 = -(D_8016E750[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol); } else { - phi_t0 = D_8016E750[3].volScales[1] - sAudioEnemyVol; + phi_t0 = D_8016E750[SEQ_PLAYER_BGM_SUB].volScales[1] - sAudioEnemyVol; } - Audio_SetVolScale(3, 3, sAudioEnemyVol, phi_t0); - Audio_StartSeq(3, 10, NA_BGM_ENEMY | 0x800); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 3, sAudioEnemyVol, phi_t0); + Audio_StartSeq(SEQ_PLAYER_BGM_SUB, 10, NA_BGM_ENEMY | 0x800); if (phi_t1 != NA_BGM_NATURE_BACKGROUND) { - Audio_SetVolScale(0, 3, (0x7F - sAudioEnemyVol) & 0xFF, 0xA); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sAudioEnemyVol) & 0xFF, 0xA); func_800F510C(sAudioEnemyVol); } } else { if ((D_8013061C & 0x7F) == 1) { - Audio_SeqCmd1(3, 10); + Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, 10); if (arg0 == 3) { phi_a3 = 0; } else { phi_a3 = 10; } - Audio_SetVolScale(0, 3, 0x7F, phi_a3); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, phi_a3); func_800F510C(0); } } @@ -3958,7 +3969,7 @@ void func_800F5E90(u8 arg0) { } D_8013061C = arg0; - Audio_SeqCmd7(0, 2, arg0); + Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 2, arg0); } } } @@ -3977,12 +3988,12 @@ void func_800F6114(f32 dist) { } sAudioEnemyVol = ((350.0f - adjDist) * 127.0f) / 350.0f; - Audio_SetVolScale(3, 3, sAudioEnemyVol, 0xA); - if (D_8016E750[0].unk_254 != NA_BGM_NATURE_BACKGROUND) { - Audio_SetVolScale(0, 3, (0x7F - sAudioEnemyVol), 0xA); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 3, sAudioEnemyVol, 0xA); + if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_BACKGROUND) { + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, (0x7F - sAudioEnemyVol), 0xA); } } - if (D_8016E750[0].unk_254 != NA_BGM_NATURE_BACKGROUND) { + if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_BACKGROUND) { func_800F510C(sAudioEnemyVol); } } @@ -3997,7 +4008,7 @@ void func_800F6268(f32 dist, u16 arg1) { sAudioHasMalonBgm = true; sAudioMalonBgmDist = dist; if (D_8016B9F2 == 0) { - temp_a0 = (s8)(func_800FA0B4(0) & 0xFF); + temp_a0 = (s8)(func_800FA0B4(SEQ_PLAYER_BGM_MAIN) & 0xFF); if (temp_a0 == (arg1 & 0xFF)) { if ((arg1 & 0xFF) == NA_BGM_LONLON) { @@ -4009,18 +4020,18 @@ void func_800F6268(f32 dist, u16 arg1) { phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f); } // Transition volume of channels 0, 1 and 13 on seq player 0 over 3 frames - Audio_SeqCmd6(0, 3, 0, 127 - phi_v1); - Audio_SeqCmd6(0, 3, 1, 127 - phi_v1); - Audio_SeqCmd6(0, 3, 13, phi_v1); + Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 3, 0, 127 - phi_v1); + Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 3, 1, 127 - phi_v1); + Audio_SeqCmd6(SEQ_PLAYER_BGM_MAIN, 3, 13, phi_v1); if (D_8016B9D8 == 0) { D_8016B9D8++; } } } else if ((temp_a0 == NA_BGM_NATURE_BACKGROUND) && ((arg1 & 0xFF) == NA_BGM_LONLON)) { - temp_a0 = (s8)(func_800FA0B4(3) & 0xFF); + temp_a0 = (s8)(func_800FA0B4(SEQ_PLAYER_BGM_SUB) & 0xFF); if ((temp_a0 != (arg1 & 0xFF)) && (D_8016B9D8 < 10)) { - func_800F5E18(3, NA_BGM_LONLON, 0, 0, 0); - Audio_SeqCmdA(3, 0xFFFC); + func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0); + Audio_SeqCmdA(SEQ_PLAYER_BGM_SUB, 0xFFFC); D_8016B9D8 = 10; } @@ -4032,8 +4043,8 @@ void func_800F6268(f32 dist, u16 arg1) { phi_v1 = (s8)(((dist - 200.0f) * 127.0f) / 1800.0f); } // Transition volume of channels 0 and 1 on seq player 0 over 3 frames - Audio_SeqCmd6(3, 3, 0, 127 - phi_v1); - Audio_SeqCmd6(3, 3, 1, 127 - phi_v1); + Audio_SeqCmd6(SEQ_PLAYER_BGM_SUB, 3, 0, 127 - phi_v1); + Audio_SeqCmd6(SEQ_PLAYER_BGM_SUB, 3, 1, 127 - phi_v1); } if (D_8016B9D8 < 10) { @@ -4058,11 +4069,11 @@ void func_800F6584(u8 arg0) { u16 sp34; D_8016B9F2 = arg0; - if ((func_800FA0B4(0) & 0xFF) == NA_BGM_LONLON) { - playerIdx = 0; + if ((func_800FA0B4(SEQ_PLAYER_BGM_MAIN) & 0xFF) == NA_BGM_LONLON) { + playerIdx = SEQ_PLAYER_BGM_MAIN; sp34 = 0; - } else if ((func_800FA0B4(3) & 0xFF) == NA_BGM_LONLON) { - playerIdx = 3; + } else if ((func_800FA0B4(SEQ_PLAYER_BGM_SUB) & 0xFF) == NA_BGM_LONLON) { + playerIdx = SEQ_PLAYER_BGM_SUB; sp34 = 0xFFFC; } else { return; @@ -4071,16 +4082,16 @@ void func_800F6584(u8 arg0) { if (arg0 != 0) { Audio_SeqCmd6(playerIdx, 1, 0, 0); Audio_SeqCmd6(playerIdx, 1, 1, 0); - if (playerIdx == 3) { + if (playerIdx == SEQ_PLAYER_BGM_SUB) { Audio_SeqCmdA(playerIdx, sp34 | 3); } } else { - if (playerIdx == 3) { - func_800F5E18(3, NA_BGM_LONLON, 0, 0, 0); + if (playerIdx == SEQ_PLAYER_BGM_SUB) { + func_800F5E18(SEQ_PLAYER_BGM_SUB, NA_BGM_LONLON, 0, 0, 0); } Audio_SeqCmd6(playerIdx, 1, 0, 0x7F); Audio_SeqCmd6(playerIdx, 1, 1, 0x7F); - if (playerIdx == 3) { + if (playerIdx == SEQ_PLAYER_BGM_SUB) { Audio_SeqCmdA(playerIdx, sp34); } } @@ -4118,7 +4129,7 @@ void func_800F6700(s8 arg0) { break; } - Audio_SeqCmdE0(0, sp1F); + Audio_SeqCmdE0(SEQ_PLAYER_BGM_MAIN, sp1F); } void Audio_SetBaseFilter(u8 filter) { @@ -4139,11 +4150,11 @@ void Audio_SetExtraFilter(u8 filter) { sAudioExtraFilter2 = filter; sAudioExtraFilter = filter; - if (D_8016E750[0].unk_254 == NA_BGM_NATURE_BACKGROUND) { + if (D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 == NA_BGM_NATURE_BACKGROUND) { for (i = 0; i < 16; i++) { t = i; // CHAN_UPD_SCRIPT_IO (seq player 0, all channels, slot 6) - Audio_QueueCmdS8(0x6000000 | ((t & 0xFF) << 8) | 6, filter); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_BGM_MAIN << 16 | ((t & 0xFF) << 8) | 6, filter); } } } @@ -4166,8 +4177,8 @@ void func_800F6964(u16 arg0) { s32 skip; u8 i; - Audio_SeqCmd1(0, (arg0 * 3) / 2); - Audio_SeqCmd1(1, (arg0 * 3) / 2); + Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, (arg0 * 3) / 2); + Audio_SeqCmd1(SEQ_PLAYER_FANFARE, (arg0 * 3) / 2); for (i = 0; i < 0x10; i++) { skip = false; switch (i) { @@ -4183,30 +4194,30 @@ void func_800F6964(u16 arg0) { } if (!skip) { - Audio_SeqCmd6(2, arg0 >> 1, i, 0); + Audio_SeqCmd6(SEQ_PLAYER_SFX, arg0 >> 1, i, 0); } } - Audio_SeqCmd1(3, (arg0 * 3) / 2); + Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, (arg0 * 3) / 2); } void func_800F6AB0(u16 arg0) { - Audio_SeqCmd1(0, arg0); - Audio_SeqCmd1(1, arg0); - Audio_SeqCmd1(3, arg0); - Audio_SetVolScale(0, 3, 0x7F, 0); - Audio_SetVolScale(0, 1, 0x7F, 0); + Audio_SeqCmd1(SEQ_PLAYER_BGM_MAIN, arg0); + Audio_SeqCmd1(SEQ_PLAYER_FANFARE, arg0); + Audio_SeqCmd1(SEQ_PLAYER_BGM_SUB, arg0); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 3, 0x7F, 0); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 1, 0x7F, 0); } void func_800F6B3C(void) { - func_800F9280(2, 0, 0xFF, 5); + func_800F9280(SEQ_PLAYER_SFX, 0, 0xFF, 5); } void Audio_DisableAllSeq(void) { - Audio_DisableSeq(0, 0); - Audio_DisableSeq(1, 0); - Audio_DisableSeq(2, 0); - Audio_DisableSeq(3, 0); + Audio_DisableSeq(SEQ_PLAYER_BGM_MAIN, 0); + Audio_DisableSeq(SEQ_PLAYER_FANFARE, 0); + Audio_DisableSeq(SEQ_PLAYER_SFX, 0); + Audio_DisableSeq(SEQ_PLAYER_BGM_SUB, 0); Audio_ScheduleProcessCmds(); } @@ -4251,7 +4262,7 @@ void func_800F6C34(void) { sSpecReverb = sSpecReverbs[gAudioSpecId]; D_80130608 = 0; D_80130628 = NA_BGM_DISABLED; - Audio_QueueCmdS8(0x46000000, -1); + Audio_QueueCmdS8(0x46 << 24 | SEQ_PLAYER_BGM_MAIN << 16, -1); sSariaBgmPtr = NULL; D_8016B9F4 = 0; D_8016B9F3 = 1; @@ -4263,13 +4274,13 @@ void func_800F6D58(u8 arg0, u8 arg1, u8 arg2) { u8 temp_a0; u8 i; - if ((D_8016E750[0].unk_254 != NA_BGM_NATURE_BACKGROUND) && func_800FA11C(1, 0xF00000FF)) { + if ((D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 != NA_BGM_NATURE_BACKGROUND) && func_800FA11C(1, 0xF00000FF)) { sAudioNatureFailed = 1; return; } if (((arg0 << 8) + arg1) == 0x101) { - if (func_800FA0B4(3) != NA_BGM_LONLON) { + if (func_800FA0B4(SEQ_PLAYER_BGM_SUB) != NA_BGM_LONLON) { D_8016B9D8 = 0; } } @@ -4281,7 +4292,7 @@ void func_800F6D58(u8 arg0, u8 arg1, u8 arg2) { } for (i = t; i <= temp_a0; i++) { - Audio_SeqCmd8(0, arg1, i, arg2); + Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, arg1, i, arg2); } } @@ -4289,30 +4300,30 @@ void func_800F6E7C(u16 arg0, u16 arg1) { u8 i; u32 t; - if (func_800FA0B4(0) == NA_BGM_WINDMILL) { + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_WINDMILL) { func_800F3F3C(0xF); return; } - Audio_SeqCmd7(0, 0, 1); - Audio_SeqCmd7(0, 4, arg0 >> 8); - Audio_SeqCmd7(0, 5, arg0 & 0xFF); - Audio_SetVolScale(0, 0, 0x7F, 1); + Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 0, 1); + Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 4, arg0 >> 8); + Audio_SeqCmd7(SEQ_PLAYER_BGM_MAIN, 5, arg0 & 0xFF); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 0, 0x7F, 1); i = 0; if (D_80133408 != 0) { i = 1; - Audio_SeqCmdE01(0, 0); + Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, 0); } - Audio_StartSeq(0, 0, NA_BGM_NATURE_BACKGROUND); + Audio_StartSeq(SEQ_PLAYER_BGM_MAIN, 0, NA_BGM_NATURE_BACKGROUND); if (i != 0) { - Audio_SeqCmdE01(0, 1); + Audio_SeqCmdE01(SEQ_PLAYER_BGM_MAIN, 1); } for (i = 0; i < 0x10; i++) { if (!(arg1 & (1 << i)) && (arg0 & (1 << i))) { - Audio_SeqCmd8(0, 1, i, 1); + Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 1, i, 1); } } } @@ -4323,17 +4334,18 @@ void func_800F6FB4(u8 arg0) { u8 b1; u8 b2; - if ((D_8016E750[0].unk_254 == NA_BGM_DISABLED) || ((D_80130658[((u8)D_8016E750[0].unk_254) & 0xFF] & 0x80) == 0)) { + if ((D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254 == NA_BGM_DISABLED) || + ((D_80130658[((u8)D_8016E750[SEQ_PLAYER_BGM_MAIN].unk_254) & 0xFF] & 0x80) == 0)) { func_800F6E7C(D_801306DC[arg0].unk_00, D_801306DC[arg0].unk_02); while ((D_801306DC[arg0].unk_04[i] != 0xFF) && (i < 100)) { // Probably a fake match, using Audio_SeqCmd8 doesn't work. b0 = D_801306DC[arg0].unk_04[i++]; b1 = D_801306DC[arg0].unk_04[i++]; b2 = D_801306DC[arg0].unk_04[i++]; - Audio_QueueSeqCmd(0x80000000 | (b1 << 0x10) | (b0 << 8) | b2); + Audio_QueueSeqCmd(0x80000000 | (SEQ_PLAYER_BGM_MAIN << 24) | (b1 << 0x10) | (b0 << 8) | b2); } - Audio_SeqCmd8(0, 0x07, 13, D_80130604); + Audio_SeqCmd8(SEQ_PLAYER_BGM_MAIN, 0x07, 13, D_80130604); } } @@ -4347,11 +4359,11 @@ void Audio_InitSound(void) { Audio_ResetSfxChannelState(); func_800FAEB4(); Audio_ResetSounds(); - func_800F9280(2, 0, 0x70, 10); + func_800F9280(SEQ_PLAYER_SFX, 0, 0x70, 10); } void func_800F7170(void) { - func_800F9280(2, 0, 0x70, 1); + func_800F9280(SEQ_PLAYER_SFX, 0, 0x70, 1); Audio_QueueCmdS32(0xF2000000, 1); Audio_ScheduleProcessCmds(); Audio_QueueCmdS32(0xF8000000, 0); @@ -4371,5 +4383,5 @@ void func_800F7208(void) { Audio_QueueCmdS32(0xF2000000, 1); func_800F6C34(); Audio_ResetSfxChannelState(); - func_800F9280(2, 0, 0x70, 1); + func_800F9280(SEQ_PLAYER_SFX, 0, 0x70, 1); } diff --git a/src/code/code_800F7260.c b/src/code/code_800F7260.c index af14f7014..b04dfb6cf 100644 --- a/src/code/code_800F7260.c +++ b/src/code/code_800F7260.c @@ -108,15 +108,15 @@ void Audio_SetSoundBanksMute(u16 muteMask) { void Audio_QueueSeqCmdMute(u8 channelIdx) { D_801333D0 |= (1 << channelIdx); - Audio_SetVolScale(0, 2, 0x40, 0xF); - Audio_SetVolScale(3, 2, 0x40, 0xF); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 2, 0x40, 0xF); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 2, 0x40, 0xF); } void Audio_ClearBGMMute(u8 channelIdx) { D_801333D0 &= ((1 << channelIdx) ^ 0xFFFF); if (D_801333D0 == 0) { - Audio_SetVolScale(0, 2, 0x7F, 0xF); - Audio_SetVolScale(3, 2, 0x7F, 0xF); + Audio_SetVolScale(SEQ_PLAYER_BGM_MAIN, 2, 0x7F, 0xF); + Audio_SetVolScale(SEQ_PLAYER_BGM_SUB, 2, 0x7F, 0xF); } } @@ -496,7 +496,7 @@ void Audio_PlayActiveSounds(u8 bankId) { entryIndex = gActiveSounds[bankId][i].entryIndex; if (entryIndex != 0xFF) { entry = &gSoundBanks[bankId][entryIndex]; - channel = gAudioContext.seqPlayers[2].channels[sCurSfxPlayerChannelIdx]; + channel = gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[sCurSfxPlayerChannelIdx]; if (entry->state == SFX_STATE_READY) { entry->channelIdx = sCurSfxPlayerChannelIdx; if (entry->sfxParams & 8) { @@ -519,10 +519,11 @@ void Audio_PlayActiveSounds(u8 bankId) { } } Audio_SetSoundProperties(bankId, entryIndex, sCurSfxPlayerChannelIdx); - Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8), 1); - Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 4, entry->sfxId & 0xFF); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8), 1); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 4, + entry->sfxId & 0xFF); if (gIsLargeSoundBank[bankId]) { - Audio_QueueCmdS8(0x06020000 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 5, + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((sCurSfxPlayerChannelIdx & 0xFF) << 8) | 5, (entry->sfxId & 0x100) >> 8); } if (entry->sfxId & 0xC00) { @@ -554,7 +555,7 @@ void Audio_StopSfxByBank(u8 bankId) { while (entryIndex != 0xFF) { entry = &gSoundBanks[bankId][entryIndex]; if (entry->state >= SFX_STATE_PLAYING_REFRESH) { - Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0); } if (entry->state != SFX_STATE_EMPTY) { Audio_RemoveSoundBankEntry(bankId, entryIndex); @@ -574,7 +575,7 @@ void func_800F8884(u8 bankId, Vec3f* pos) { entry = &gSoundBanks[bankId][entryIndex]; if (entry->posX == &pos->x) { if (entry->state >= SFX_STATE_PLAYING_REFRESH) { - Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0); } if (entry->state != SFX_STATE_EMPTY) { Audio_RemoveSoundBankEntry(bankId, entryIndex); @@ -616,7 +617,7 @@ void Audio_StopSfxByPosAndId(Vec3f* pos, u16 sfxId) { entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex]; if (entry->posX == &pos->x && entry->sfxId == sfxId) { if (entry->state >= SFX_STATE_PLAYING_REFRESH) { - Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0); } if (entry->state != SFX_STATE_EMPTY) { Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex); @@ -644,7 +645,7 @@ void Audio_StopSfxByTokenAndId(u8 token, u16 sfxId) { entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex]; if (entry->token == token && entry->sfxId == sfxId) { if (entry->state >= SFX_STATE_PLAYING_REFRESH) { - Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0); } if (entry->state != SFX_STATE_EMPTY) { Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex); @@ -671,7 +672,7 @@ void Audio_StopSfxById(u32 sfxId) { entry = &gSoundBanks[SFX_BANK(sfxId)][entryIndex]; if (entry->sfxId == sfxId) { if (entry->state >= SFX_STATE_PLAYING_REFRESH) { - Audio_QueueCmdS8(0x06020000 | ((entry->channelIdx & 0xFF) << 8), 0); + Audio_QueueCmdS8(0x6 << 24 | SEQ_PLAYER_SFX << 16 | ((entry->channelIdx & 0xFF) << 8), 0); } if (entry->state != SFX_STATE_EMPTY) { Audio_RemoveSoundBankEntry(SFX_BANK(sfxId), entryIndex); @@ -715,7 +716,7 @@ void Audio_StepUnusedBankLerp(u8 bankId) { void func_800F8F88(void) { u8 bankId; - if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[2].channels[0])) { + if (IS_SEQUENCE_CHANNEL_VALID(gAudioContext.seqPlayers[SEQ_PLAYER_SFX].channels[0])) { sCurSfxPlayerChannelIdx = 0; for (bankId = 0; bankId < ARRAY_COUNT(gSoundBanks); bankId++) { Audio_ChooseActiveSounds(bankId); diff --git a/src/code/code_800F9280.c b/src/code/code_800F9280.c index 4d2a5143f..e6dd4b67d 100644 --- a/src/code/code_800F9280.c +++ b/src/code/code_800F9280.c @@ -27,7 +27,7 @@ void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer) { u16 dur; s32 pad; - if (D_80133408 == 0 || playerIdx == 2) { + if (D_80133408 == 0 || playerIdx == SEQ_PLAYER_SFX) { arg2 &= 0x7F; if (arg2 == 0x7F) { dur = (fadeTimer >> 3) * 60 * gAudioContext.audioBufferParameters.updatesPerFrame; @@ -60,10 +60,10 @@ void func_800F9280(u8 playerIdx, u8 seqId, u8 arg2, u16 fadeTimer) { } } -void func_800F9474(u8 arg0, u16 arg1) { - Audio_QueueCmdS32(0x83000000 | ((u8)arg0 << 16), +void func_800F9474(u8 playerIdx, u16 arg1) { + Audio_QueueCmdS32(0x83000000 | ((u8)playerIdx << 16), (arg1 * (u16)gAudioContext.audioBufferParameters.updatesPerFrame) / 4); - D_8016E750[arg0].unk_254 = NA_BGM_DISABLED; + D_8016E750[playerIdx].unk_254 = NA_BGM_DISABLED; } typedef enum { @@ -387,18 +387,18 @@ s32 func_800FA11C(u32 arg0, u32 arg1) { return true; } -void func_800FA174(u8 arg0) { - D_8016E348[arg0] = 0; +void func_800FA174(u8 playerIdx) { + D_8016E348[playerIdx] = 0; } -void func_800FA18C(u8 arg0, u8 arg1) { +void func_800FA18C(u8 playeridx, u8 arg1) { u8 i; - for (i = 0; i < D_8016E750[arg0].unk_4D; i++) { - u8 unkb = (D_8016E750[arg0].unk_2C[i] & 0xF00000) >> 20; + for (i = 0; i < D_8016E750[playeridx].unk_4D; i++) { + u8 unkb = (D_8016E750[playeridx].unk_2C[i] & 0xF00000) >> 20; if (unkb == arg1) { - D_8016E750[arg0].unk_2C[i] = 0xFF000000; + D_8016E750[playeridx].unk_2C[i] = 0xFF000000; } } } @@ -435,54 +435,54 @@ void func_800FA3DC(void) { u32 dummy; f32 phi_f0; u8 phi_t0; - u8 i; + u8 playerIdx; u8 j; u8 k; - for (i = 0; i < 4; i++) { - if (D_8016E750[i].unk_260 != 0) { + for (playerIdx = 0; playerIdx < 4; playerIdx++) { + if (D_8016E750[playerIdx].unk_260 != 0) { switch (func_800E5E20(&dummy)) { case 1: case 2: case 3: case 4: - D_8016E750[i].unk_260 = 0; - Audio_ProcessSeqCmd(D_8016E750[i].unk_25C); + D_8016E750[playerIdx].unk_260 = 0; + Audio_ProcessSeqCmd(D_8016E750[playerIdx].unk_25C); break; } } - if (D_8016E750[i].fadeVolUpdate) { + if (D_8016E750[playerIdx].fadeVolUpdate) { phi_f0 = 1.0f; for (j = 0; j < 4; j++) { - phi_f0 *= (D_8016E750[i].volScales[j] / 127.0f); + phi_f0 *= (D_8016E750[playerIdx].volScales[j] / 127.0f); } - Audio_SeqCmd4(i, D_8016E750[i].volFadeTimer, (u8)(phi_f0 * 127.0f)); - D_8016E750[i].fadeVolUpdate = 0; + Audio_SeqCmd4(playerIdx, D_8016E750[playerIdx].volFadeTimer, (u8)(phi_f0 * 127.0f)); + D_8016E750[playerIdx].fadeVolUpdate = 0; } - if (D_8016E750[i].unk_0C != 0) { - D_8016E750[i].unk_0C--; + if (D_8016E750[playerIdx].unk_0C != 0) { + D_8016E750[playerIdx].unk_0C--; - if (D_8016E750[i].unk_0C != 0) { - D_8016E750[i].volCur = D_8016E750[i].volCur - D_8016E750[i].unk_08; + if (D_8016E750[playerIdx].unk_0C != 0) { + D_8016E750[playerIdx].volCur = D_8016E750[playerIdx].volCur - D_8016E750[playerIdx].unk_08; } else { - D_8016E750[i].volCur = D_8016E750[i].volTarget; + D_8016E750[playerIdx].volCur = D_8016E750[playerIdx].volTarget; } - Audio_QueueCmdF32(0x41000000 | _SHIFTL(i, 16, 8), D_8016E750[i].volCur); + Audio_QueueCmdF32(0x41000000 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].volCur); } - if (D_8016E750[i].unk_14 != 0) { - temp_a1 = D_8016E750[i].unk_14; + if (D_8016E750[playerIdx].unk_14 != 0) { + temp_a1 = D_8016E750[playerIdx].unk_14; phi_t0 = (temp_a1 & 0xFF0000) >> 15; phi_a2 = temp_a1 & 0xFFF; if (phi_t0 == 0) { phi_t0++; } - if (gAudioContext.seqPlayers[i].enabled) { - temp_lo = gAudioContext.seqPlayers[i].tempo / 0x30; + if (gAudioContext.seqPlayers[playerIdx].enabled) { + temp_lo = gAudioContext.seqPlayers[playerIdx].tempo / 0x30; temp_v0_4 = (temp_a1 & 0xF000) >> 12; switch (temp_v0_4) { case 1: @@ -497,8 +497,8 @@ void func_800FA3DC(void) { phi_a2 = temp_lo * (phi_a2 / 100.0f); break; case 4: - if (D_8016E750[i].unk_18) { - phi_a2 = D_8016E750[i].unk_18; + if (D_8016E750[playerIdx].unk_18) { + phi_a2 = D_8016E750[playerIdx].unk_18; } else { phi_a2 = temp_lo; } @@ -509,95 +509,95 @@ void func_800FA3DC(void) { phi_a2 = 300; } - if (D_8016E750[i].unk_18 == 0) { - D_8016E750[i].unk_18 = temp_lo; + if (D_8016E750[playerIdx].unk_18 == 0) { + D_8016E750[playerIdx].unk_18 = temp_lo; } - D_8016E750[i].unk_20 = phi_a2; - D_8016E750[i].unk_1C = gAudioContext.seqPlayers[i].tempo / 0x30; - D_8016E750[i].unk_24 = (D_8016E750[i].unk_1C - D_8016E750[i].unk_20) / phi_t0; - D_8016E750[i].unk_28 = phi_t0; - D_8016E750[i].unk_14 = 0; + D_8016E750[playerIdx].unk_20 = phi_a2; + D_8016E750[playerIdx].unk_1C = gAudioContext.seqPlayers[playerIdx].tempo / 0x30; + D_8016E750[playerIdx].unk_24 = (D_8016E750[playerIdx].unk_1C - D_8016E750[playerIdx].unk_20) / phi_t0; + D_8016E750[playerIdx].unk_28 = phi_t0; + D_8016E750[playerIdx].unk_14 = 0; } } - if (D_8016E750[i].unk_28 != 0) { - D_8016E750[i].unk_28--; - if (D_8016E750[i].unk_28 != 0) { - D_8016E750[i].unk_1C = D_8016E750[i].unk_1C - D_8016E750[i].unk_24; + if (D_8016E750[playerIdx].unk_28 != 0) { + D_8016E750[playerIdx].unk_28--; + if (D_8016E750[playerIdx].unk_28 != 0) { + D_8016E750[playerIdx].unk_1C = D_8016E750[playerIdx].unk_1C - D_8016E750[playerIdx].unk_24; } else { - D_8016E750[i].unk_1C = D_8016E750[i].unk_20; + D_8016E750[playerIdx].unk_1C = D_8016E750[playerIdx].unk_20; } // set tempo - Audio_QueueCmdS32(0x47000000 | _SHIFTL(i, 16, 8), D_8016E750[i].unk_1C); + Audio_QueueCmdS32(0x47000000 | _SHIFTL(playerIdx, 16, 8), D_8016E750[playerIdx].unk_1C); } - if (D_8016E750[i].unk_252 != 0) { + if (D_8016E750[playerIdx].unk_252 != 0) { for (k = 0; k < 0x10; k++) { - if (D_8016E750[i].unk_50[k].unk_0C != 0) { - D_8016E750[i].unk_50[k].unk_0C--; - if (D_8016E750[i].unk_50[k].unk_0C != 0) { - D_8016E750[i].unk_50[k].unk_00 -= D_8016E750[i].unk_50[k].unk_08; + if (D_8016E750[playerIdx].unk_50[k].unk_0C != 0) { + D_8016E750[playerIdx].unk_50[k].unk_0C--; + if (D_8016E750[playerIdx].unk_50[k].unk_0C != 0) { + D_8016E750[playerIdx].unk_50[k].unk_00 -= D_8016E750[playerIdx].unk_50[k].unk_08; } else { - D_8016E750[i].unk_50[k].unk_00 = D_8016E750[i].unk_50[k].unk_04; - D_8016E750[i].unk_252 ^= (1 << k); + D_8016E750[playerIdx].unk_50[k].unk_00 = D_8016E750[playerIdx].unk_50[k].unk_04; + D_8016E750[playerIdx].unk_252 ^= (1 << k); } - // CHAN_UPD_VOL_SCALE (i = seq, k = chan) - Audio_QueueCmdF32(0x01000000 | _SHIFTL(i, 16, 8) | _SHIFTL(k, 8, 8), - D_8016E750[i].unk_50[k].unk_00); + // CHAN_UPD_VOL_SCALE (playerIdx = seq, k = chan) + Audio_QueueCmdF32(0x01000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(k, 8, 8), + D_8016E750[playerIdx].unk_50[k].unk_00); } } } - if (D_8016E750[i].unk_250 != 0) { + if (D_8016E750[playerIdx].unk_250 != 0) { for (k = 0; k < 0x10; k++) { - if (D_8016E750[i].unk_50[k].unk_1C != 0) { - D_8016E750[i].unk_50[k].unk_1C--; - if (D_8016E750[i].unk_50[k].unk_1C != 0) { - D_8016E750[i].unk_50[k].unk_10 -= D_8016E750[i].unk_50[k].unk_18; + if (D_8016E750[playerIdx].unk_50[k].unk_1C != 0) { + D_8016E750[playerIdx].unk_50[k].unk_1C--; + if (D_8016E750[playerIdx].unk_50[k].unk_1C != 0) { + D_8016E750[playerIdx].unk_50[k].unk_10 -= D_8016E750[playerIdx].unk_50[k].unk_18; } else { - D_8016E750[i].unk_50[k].unk_10 = D_8016E750[i].unk_50[k].unk_14; - D_8016E750[i].unk_250 ^= (1 << k); + D_8016E750[playerIdx].unk_50[k].unk_10 = D_8016E750[playerIdx].unk_50[k].unk_14; + D_8016E750[playerIdx].unk_250 ^= (1 << k); } // CHAN_UPD_FREQ_SCALE - Audio_QueueCmdF32(0x04000000 | _SHIFTL(i, 16, 8) | _SHIFTL(k, 8, 8), - D_8016E750[i].unk_50[k].unk_10); + Audio_QueueCmdF32(0x04000000 | _SHIFTL(playerIdx, 16, 8) | _SHIFTL(k, 8, 8), + D_8016E750[playerIdx].unk_50[k].unk_10); } } } - if (D_8016E750[i].unk_4D != 0) { + if (D_8016E750[playerIdx].unk_4D != 0) { if (func_800FA11C(0xF0000000, 0xF0000000) == 0) { - D_8016E750[i].unk_4D = 0; + D_8016E750[playerIdx].unk_4D = 0; return; } - if (D_8016E750[i].unk_4C != 0) { - D_8016E750[i].unk_4C--; + if (D_8016E750[playerIdx].unk_4C != 0) { + D_8016E750[playerIdx].unk_4C--; continue; } - if (gAudioContext.seqPlayers[i].enabled) { + if (gAudioContext.seqPlayers[playerIdx].enabled) { continue; } - for (j = 0; j < D_8016E750[i].unk_4D; j++) { - temp_a0 = (D_8016E750[i].unk_2C[j] & 0x00F00000) >> 20; - temp_s1 = (D_8016E750[i].unk_2C[j] & 0x000F0000) >> 16; - temp_s0_3 = (D_8016E750[i].unk_2C[j] & 0xFF00) >> 8; - temp_a3_3 = D_8016E750[i].unk_2C[j] & 0xFF; + for (j = 0; j < D_8016E750[playerIdx].unk_4D; j++) { + temp_a0 = (D_8016E750[playerIdx].unk_2C[j] & 0x00F00000) >> 20; + temp_s1 = (D_8016E750[playerIdx].unk_2C[j] & 0x000F0000) >> 16; + temp_s0_3 = (D_8016E750[playerIdx].unk_2C[j] & 0xFF00) >> 8; + temp_a3_3 = D_8016E750[playerIdx].unk_2C[j] & 0xFF; switch (temp_a0) { case 0: Audio_SetVolScale(temp_s1, 1, 0x7F, temp_a3_3); break; case 7: - if (D_8016E348[i] == temp_a3_3) { + if (D_8016E348[playerIdx] == temp_a3_3) { Audio_SetVolScale(temp_s1, 1, 0x7F, temp_s0_3); } break; case 1: - Audio_SeqCmd3(i, D_8016E750[i].unk_254); + Audio_SeqCmd3(playerIdx, D_8016E750[playerIdx].unk_254); break; case 2: Audio_StartSeq(temp_s1, 1, D_8016E750[temp_s1].unk_254); @@ -611,13 +611,13 @@ void func_800FA3DC(void) { Audio_SeqCmdB40(temp_s1, temp_a3_3, 0); break; case 5: - temp_v1 = D_8016E750[i].unk_2C[j] & 0xFFFF; + temp_v1 = D_8016E750[playerIdx].unk_2C[j] & 0xFFFF; Audio_StartSeq(temp_s1, D_8016E750[temp_s1].unk_4E, temp_v1); Audio_SetVolScale(temp_s1, 1, 0x7F, 0); D_8016E750[temp_s1].unk_4E = 0; break; case 6: - D_8016E750[i].unk_4E = temp_s0_3; + D_8016E750[playerIdx].unk_4E = temp_s0_3; break; case 8: Audio_SetVolScale(temp_s1, temp_s0_3, 0x7F, temp_a3_3); @@ -634,7 +634,7 @@ void func_800FA3DC(void) { } break; case 9: - temp_v1 = D_8016E750[i].unk_2C[j] & 0xFFFF; + temp_v1 = D_8016E750[playerIdx].unk_2C[j] & 0xFFFF; Audio_SeqCmdA(temp_s1, temp_v1); break; case 10: @@ -643,7 +643,7 @@ void func_800FA3DC(void) { } } - D_8016E750[i].unk_4D = 0; + D_8016E750[playerIdx].unk_4D = 0; } } } @@ -668,37 +668,37 @@ u8 func_800FAD34(void) { } void func_800FADF8(void) { - u8 i, j; - - for (i = 0; i < 4; i++) { - D_8016E348[i] = 0; - D_8016E750[i].unk_254 = NA_BGM_DISABLED; - D_8016E750[i].unk_256 = NA_BGM_DISABLED; - D_8016E750[i].unk_28 = 0; - D_8016E750[i].unk_18 = 0; - D_8016E750[i].unk_14 = 0; - D_8016E750[i].unk_258 = 0; - D_8016E750[i].unk_4D = 0; - D_8016E750[i].unk_4E = 0; - D_8016E750[i].unk_250 = 0; - D_8016E750[i].unk_252 = 0; + u8 playerIdx, j; + + for (playerIdx = 0; playerIdx < 4; playerIdx++) { + D_8016E348[playerIdx] = 0; + D_8016E750[playerIdx].unk_254 = NA_BGM_DISABLED; + D_8016E750[playerIdx].unk_256 = NA_BGM_DISABLED; + D_8016E750[playerIdx].unk_28 = 0; + D_8016E750[playerIdx].unk_18 = 0; + D_8016E750[playerIdx].unk_14 = 0; + D_8016E750[playerIdx].unk_258 = 0; + D_8016E750[playerIdx].unk_4D = 0; + D_8016E750[playerIdx].unk_4E = 0; + D_8016E750[playerIdx].unk_250 = 0; + D_8016E750[playerIdx].unk_252 = 0; for (j = 0; j < 4; j++) { - D_8016E750[i].volScales[j] = 0x7F; + D_8016E750[playerIdx].volScales[j] = 0x7F; } - D_8016E750[i].volFadeTimer = 1; - D_8016E750[i].fadeVolUpdate = 1; + D_8016E750[playerIdx].volFadeTimer = 1; + D_8016E750[playerIdx].fadeVolUpdate = 1; } } void func_800FAEB4(void) { - u8 i, j; + u8 playerIdx, j; - for (i = 0; i < 4; i++) { - D_8016E750[i].volCur = 1.0f; - D_8016E750[i].unk_0C = 0; - D_8016E750[i].fadeVolUpdate = 0; + for (playerIdx = 0; playerIdx < 4; playerIdx++) { + D_8016E750[playerIdx].volCur = 1.0f; + D_8016E750[playerIdx].unk_0C = 0; + D_8016E750[playerIdx].fadeVolUpdate = 0; for (j = 0; j < 4; j++) { - D_8016E750[i].volScales[j] = 0x7F; + D_8016E750[playerIdx].volScales[j] = 0x7F; } } func_800FADF8(); diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 413d84e07..11b7795b8 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -456,9 +456,9 @@ void Cutscene_Command_FadeBGM(GlobalContext* globalCtx, CutsceneContext* csCtx, var1 = cmd->endFrame - cmd->startFrame; if (cmd->type == 3) { - Audio_QueueSeqCmd(var1 << 0x10 | 0x110000FF); + Audio_QueueSeqCmd(var1 << 0x10 | (0x1 << 28 | SEQ_PLAYER_FANFARE << 24 | 0xFF)); } else { - Audio_QueueSeqCmd(var1 << 0x10 | 0x100000FF); + Audio_QueueSeqCmd(var1 << 0x10 | (0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xFF)); } } } diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 736666ffc..ea09e2c0c 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -1925,7 +1925,7 @@ void func_800758AC(GlobalContext* globalCtx) { func_800F6FB4(4); } else if (((void)0, gSaveContext.unk_140E) != NA_BGM_GENERAL_SFX) { if (!func_80077600()) { - Audio_QueueSeqCmd((s32)((void)0, gSaveContext.unk_140E)); + Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | (s32)((void)0, gSaveContext.unk_140E)); } gSaveContext.unk_140E = NA_BGM_GENERAL_SFX; } else if (globalCtx->soundCtx.seqIndex == NA_BGM_NO_MUSIC) { @@ -1985,7 +1985,7 @@ void func_80075B44(GlobalContext* globalCtx) { case 1: if (gSaveContext.dayTime > 0xB71C) { if (globalCtx->envCtx.unk_EE[0] == 0 && globalCtx->envCtx.unk_F2[0] == 0) { - Audio_QueueSeqCmd(0x10F000FF); + Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xF000FF); } globalCtx->envCtx.unk_E0++; } @@ -2419,7 +2419,7 @@ void func_80077684(GlobalContext* globalCtx) { func_800F6D58(14, 1, 0); func_800F6D58(15, 1, 0); - if (func_800FA0B4(0) == NA_BGM_NATURE_BACKGROUND) { + if (func_800FA0B4(SEQ_PLAYER_BGM_MAIN) == NA_BGM_NATURE_BACKGROUND) { gSaveContext.seqIndex = NA_BGM_NATURE_SFX_RAIN; func_800758AC(globalCtx); } |
