diff options
| author | briaguya <70942617+briaguya-ai@users.noreply.github.com> | 2023-02-16 09:49:45 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-16 09:49:45 -0500 |
| commit | 1e6ec1bddadfb75ad0d57a44255bf62ff729a784 (patch) | |
| tree | b78c7092d6a3a667a2590ac78c6ad9b0406bbd0a /soh/src/code | |
| parent | 27f961ac4f50e8ae384f7953e8ccf0f35e7c29c4 (diff) | |
exclude audio from shuffle (#2411)
* Rename "SFX Editor" to "Audio Editor"
* Move some functionality out into a new class `AudioCollection`
* Add a tab to exclude sfx/sequences from shuffle pool
---------
Co-authored-by: briaguya <briaguya@alice>
Co-authored-by: briaguya <briaguya>
Co-authored-by: David Chavez <david@dcvz.io>
Diffstat (limited to 'soh/src/code')
| -rw-r--r-- | soh/src/code/audio_load.c | 10 | ||||
| -rw-r--r-- | soh/src/code/audio_seqplayer.c | 4 | ||||
| -rw-r--r-- | soh/src/code/code_800EC960.c | 18 | ||||
| -rw-r--r-- | soh/src/code/code_800F7260.c | 2 | ||||
| -rw-r--r-- | soh/src/code/code_800F9280.c | 8 |
5 files changed, 32 insertions, 10 deletions
diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index 4b4b027f3..fe1d25882 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -5,7 +5,7 @@ #include <libultraship/libultra.h> #include "global.h" #include "soh/OTRGlobals.h" -#include "soh/Enhancements/sfx-editor/SfxEditor.h" +#include "soh/Enhancements/audio/AudioCollection.h" #define MK_ASYNC_MSG(retData, tableType, id, status) (((retData) << 24) | ((tableType) << 16) | ((id) << 8) | (status)) #define ASYNC_TBLTYPE(v) ((u8)(v >> 16)) @@ -487,7 +487,7 @@ u8* AudioLoad_GetFontsForSequence(s32 seqId, u32* outNumFonts) { if (seqId == NA_BGM_DISABLED) return NULL; - u16 newSeqId = SfxEditor_GetReplacementSeq(seqId); + u16 newSeqId = AudioEditor_GetReplacementSeq(seqId); if (newSeqId > MAX_SEQUENCES || !sequenceMap[newSeqId]) { return NULL; } @@ -613,7 +613,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { AudioSeq_SkipForwardSequence(seqPlayer); //! @bug missing return (but the return value is not used so it's not UB) if (CVarGetInteger("gSeqNameOverlay", 0) && playerIdx == SEQ_PLAYER_BGM_MAIN) { - const char* sequenceName = SfxEditor_GetSequenceName(seqId); + const char* sequenceName = AudioCollection_GetSequenceName(seqId); if (sequenceName != NULL) { Overlay_DisplayText_Seconds(CVarGetInteger("gSeqNameOverlayDuration", 5), sequenceName); } @@ -1341,7 +1341,7 @@ void AudioLoad_Init(void* heap, size_t heapSize) { for (size_t i = startingSeqNum; i < startingSeqNum + customSeqListSize; i++) { int j = i - startingSeqNum; - SfxEditor_AddSequence(customSeqList[j], i); + AudioCollection_AddToCollection(customSeqList[j], i); SequenceData sDat = ResourceMgr_LoadSeqByName(customSeqList[j]); sDat.seqNumber = i; @@ -1545,7 +1545,7 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone) { size_t size; seqId = AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId); - u16 newSeqId = SfxEditor_GetReplacementSeq(seqId); + u16 newSeqId = AudioEditor_GetReplacementSeq(seqId); if (seqId != newSeqId) { gAudioContext.seqToPlay[SEQ_PLAYER_BGM_MAIN] = newSeqId; gAudioContext.seqReplaced[SEQ_PLAYER_BGM_MAIN] = 1; diff --git a/soh/src/code/audio_seqplayer.c b/soh/src/code/audio_seqplayer.c index 4c38524c6..0b5192b0b 100644 --- a/soh/src/code/audio_seqplayer.c +++ b/soh/src/code/audio_seqplayer.c @@ -1067,7 +1067,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { seqPlayer->seqId = gAudioContext.seqToPlay[seqPlayer->playerIdx]; gAudioContext.seqReplaced[seqPlayer->playerIdx] = 0; } - u16 seqId = SfxEditor_GetReplacementSeq(seqPlayer->seqId); + u16 seqId = AudioEditor_GetReplacementSeq(seqPlayer->seqId); SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqId]); command = sDat.fonts[sDat.numFonts - result - 1]; } @@ -1184,7 +1184,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) { seqPlayer->seqId = gAudioContext.seqToPlay[seqPlayer->playerIdx]; gAudioContext.seqReplaced[seqPlayer->playerIdx] = 0; } - u16 seqId = SfxEditor_GetReplacementSeq(seqPlayer->seqId); + u16 seqId = AudioEditor_GetReplacementSeq(seqPlayer->seqId); SequenceData sDat = ResourceMgr_LoadSeqByName(sequenceMap[seqId]); // The game apparantely would sometimes do negative array lookups, the result of which would get rejected by AudioHeap_SearchCaches, never diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index ed5bd6fee..2838cbdc5 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -1700,7 +1700,7 @@ void Audio_OcaSetInstrument(u8 arg0) { } u16 sfxEditorId = arg0 + 0x81; - u16 newArg0 = SfxEditor_GetReplacementSeq(sfxEditorId); + u16 newArg0 = AudioEditor_GetReplacementSeq(sfxEditorId); if (newArg0 != sfxEditorId) { gAudioContext.seqReplaced[SEQ_PLAYER_SFX] = 1; arg0 = newArg0 - 0x81; @@ -4601,6 +4601,22 @@ void func_800F5ACC(u16 seqId) { } } +// based on func_800F5ACC +void PreviewSequence(u16 seqId) { + u16 curSeqId = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); + + if ((curSeqId & 0xFF) != NA_BGM_GANON_TOWER && (curSeqId & 0xFF) != NA_BGM_ESCAPE && curSeqId != seqId) { + Audio_SetSequenceMode(SEQ_MODE_IGNORE); + if (curSeqId != NA_BGM_DISABLED) { + sPrevMainBgmSeqId = curSeqId; + } else { + osSyncPrintf("Middle Boss BGM Start not stack \n"); + } + + Audio_QueuePreviewSeqCmd(seqId); + } +} + /** * Restores the previous sequence to the main bgm player before func_800F5ACC was called */ diff --git a/soh/src/code/code_800F7260.c b/soh/src/code/code_800F7260.c index 109a7079a..5395e0691 100644 --- a/soh/src/code/code_800F7260.c +++ b/soh/src/code/code_800F7260.c @@ -221,7 +221,7 @@ void Audio_ProcessSoundRequest(void) if (req->sfxId == 0) { return; } - u16 newSfxId = SfxEditor_GetReplacementSeq(req->sfxId); + u16 newSfxId = AudioEditor_GetReplacementSeq(req->sfxId); if (req->sfxId != newSfxId) { gAudioContext.seqReplaced[SEQ_PLAYER_SFX] = 1; req->sfxId = newSfxId; diff --git a/soh/src/code/code_800F9280.c b/soh/src/code/code_800F9280.c index c6d9cb657..2963b543a 100644 --- a/soh/src/code/code_800F9280.c +++ b/soh/src/code/code_800F9280.c @@ -373,7 +373,7 @@ void Audio_QueueSeqCmd(u32 cmd) if (op == 0 || op == 2 || op == 12) { u8 seqId = cmd & 0xFF; u8 playerIdx = GET_PLAYER_IDX(cmd); - u16 newSeqId = SfxEditor_GetReplacementSeq(seqId); + u16 newSeqId = AudioEditor_GetReplacementSeq(seqId); gAudioContext.seqReplaced[playerIdx] = (seqId != newSeqId); gAudioContext.seqToPlay[playerIdx] = newSeqId; cmd |= (seqId & 0xFF); @@ -382,6 +382,12 @@ void Audio_QueueSeqCmd(u32 cmd) sAudioSeqCmds[sSeqCmdWrPos++] = cmd; } +void Audio_QueuePreviewSeqCmd(u16 seqId) { + gAudioContext.seqReplaced[0] = 1; + gAudioContext.seqToPlay[0] = seqId; + sAudioSeqCmds[sSeqCmdWrPos++] = 1; +} + void Audio_ProcessSeqCmds(void) { while (sSeqCmdWrPos != sSeqCmdRdPos) { Audio_ProcessSeqCmd(sAudioSeqCmds[sSeqCmdRdPos++]); |
