mirror of
https://github.com/zeldaret/mm.git
synced 2026-06-01 09:47:18 -04:00
Audio Sequences: Scene/Ambience/SeqFlags Functions OK (#1033)
* import audio scene seq docs * cleanup * fix scene cmd * small fixes * more PR suggestions * missed comment * rename spot to resume * cleanup comments * SEQ_IO_VAL_NONE * Empty-Commit * another PR suggestion
This commit is contained in:
@@ -315,7 +315,7 @@ void AudioSeq_InitSequenceChannel(SequenceChannel* channel) {
|
||||
channel->freqScale = 1.0f;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(channel->soundScriptIO); i++) {
|
||||
channel->soundScriptIO[i] = -1;
|
||||
channel->soundScriptIO[i] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
|
||||
channel->unused = false;
|
||||
@@ -1791,12 +1791,12 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||
|
||||
case 0x10: // channel: load sample
|
||||
if (lowBits < 8) {
|
||||
channel->soundScriptIO[lowBits] = -1;
|
||||
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||
if (AudioLoad_SlowLoadSample(channel->fontId, scriptState->value,
|
||||
&channel->soundScriptIO[lowBits]) == -1) {}
|
||||
} else {
|
||||
lowBits -= 8;
|
||||
channel->soundScriptIO[lowBits] = -1;
|
||||
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||
if (AudioLoad_SlowLoadSample(channel->fontId, channel->unk_22 + 0x100,
|
||||
&channel->soundScriptIO[lowBits]) == -1) {}
|
||||
}
|
||||
@@ -1805,7 +1805,7 @@ void AudioSeq_SequenceChannelProcessScript(SequenceChannel* channel) {
|
||||
case 0x60: // channel: io read value
|
||||
scriptState->value = channel->soundScriptIO[lowBits];
|
||||
if (lowBits < 2) {
|
||||
channel->soundScriptIO[lowBits] = -1;
|
||||
channel->soundScriptIO[lowBits] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2150,7 +2150,7 @@ void AudioSeq_SequencePlayerProcessSequence(SequencePlayer* seqPlayer) {
|
||||
case 0x80: // seqPlayer: io read value
|
||||
seqScript->value = seqPlayer->soundScriptIO[cmdLowBits];
|
||||
if (cmdLowBits < 2) {
|
||||
seqPlayer->soundScriptIO[cmdLowBits] = -1;
|
||||
seqPlayer->soundScriptIO[cmdLowBits] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2286,7 +2286,7 @@ void AudioSeq_InitSequencePlayer(SequencePlayer* seqPlayer) {
|
||||
seqPlayer->applyBend = false;
|
||||
|
||||
for (j = 0; j < ARRAY_COUNT(seqPlayer->soundScriptIO); j++) {
|
||||
seqPlayer->soundScriptIO[j] = -1;
|
||||
seqPlayer->soundScriptIO[j] = SEQ_IO_VAL_NONE;
|
||||
}
|
||||
|
||||
seqPlayer->muteFlags = MUTE_FLAGS_SOFTEN | MUTE_FLAGS_STOP_NOTES;
|
||||
|
||||
+1120
-536
File diff suppressed because it is too large
Load Diff
@@ -671,7 +671,7 @@ void AudioSfx_PlayActiveSfx(u8 bankId) {
|
||||
// "one-frame" sfx
|
||||
entry->state = SFX_STATE_PLAYING_ONE_FRAME;
|
||||
}
|
||||
} else if ((u8)channel->soundScriptIO[1] == 0xFF) {
|
||||
} else if ((u8)channel->soundScriptIO[1] == (u8)SEQ_IO_VAL_NONE) {
|
||||
// Signal from seq 0 that the sfx is finished playing. Remove entry
|
||||
AudioSfx_RemoveBankEntry(bankId, entryIndex);
|
||||
} else if (entry->state == SFX_STATE_PLAYING_REFRESH) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StartSequence.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D04.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_StopSequence.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A7D84.s")
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A89D0.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8A50.s")
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/Audio_GetActiveSequence.s")
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/code_801A7B10/func_801A8ABC.s")
|
||||
|
||||
|
||||
+1
-1
@@ -225,7 +225,7 @@ void GameState_Init(GameState* gameState, GameStateFunc init, GraphicsContext* g
|
||||
|
||||
void GameState_Destroy(GameState* gameState) {
|
||||
AudioMgr_StopAllSfxExceptSystem();
|
||||
func_8019E014();
|
||||
Audio_Update();
|
||||
osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK);
|
||||
|
||||
if (gameState->destroy != NULL) {
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ void Graph_UpdateGame(GameState* gameState) {
|
||||
Game_UpdateInput(gameState);
|
||||
Game_IncrementFrameCount(gameState);
|
||||
if (SREG(20) < 3) {
|
||||
func_8019E014();
|
||||
Audio_Update();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ void SaveContext_Init(void) {
|
||||
bzero(&gSaveContext, sizeof(SaveContext));
|
||||
|
||||
gSaveContext.save.playerForm = 0;
|
||||
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.nightSeqIndex = 0xFF;
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
|
||||
gSaveContext.unk_3F46 = NA_BGM_GENERAL_SFX;
|
||||
gSaveContext.nextCutsceneIndex = 0xFFEF;
|
||||
gSaveContext.cutsceneTrigger = 0;
|
||||
|
||||
+13
-17
@@ -152,7 +152,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
|
||||
break;
|
||||
case 0x2:
|
||||
if (isStartFrame) {
|
||||
func_801A47DC(NATURE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0);
|
||||
Audio_SetAmbienceChannelIO(AMBIENCE_CHANNEL_LIGHTNING, CHANNEL_IO_PORT_0, 0);
|
||||
Environment_AddLightningBolts(play, 3);
|
||||
D_801F4E68 = 1;
|
||||
}
|
||||
@@ -376,14 +376,14 @@ void Cutscene_Command_SetLighting(PlayState* play, CutsceneContext* csCtx, CsCmd
|
||||
// Command 0x12C: Plays a sequence (Background music or Fanfare)
|
||||
void Cutscene_Command_PlaySequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) {
|
||||
if (csCtx->frames == cmd->startFrame) {
|
||||
func_801A2C88(cmd->sequence - 1);
|
||||
Audio_PlaySequenceInCutscene(cmd->sequence - 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Command 0x12D: Stops a sequence (Background music or Fanfare)
|
||||
void Cutscene_Command_StopSequence(PlayState* play, CutsceneContext* csCtx, CsCmdSequenceChange* cmd) {
|
||||
if ((csCtx->frames >= cmd->startFrame) && (cmd->endFrame >= csCtx->frames)) {
|
||||
func_801A2D54(cmd->sequence - 1);
|
||||
Audio_StopSequenceInCutscene(cmd->sequence - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -403,9 +403,7 @@ void Cutscene_Command_FadeSequence(PlayState* play, CutsceneContext* csCtx, CsCm
|
||||
// Command 0x12E: Play Ambience sequence
|
||||
void Cutscene_Command_PlayAmbienceSequence(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
|
||||
if (csCtx->frames == cmd->startFrame) {
|
||||
// Audio_PlayNatureAmbienceSequence
|
||||
// nightSeqIndex is natureAmbienceId
|
||||
func_801A4A28(play->soundCtx.nightSeqIndex);
|
||||
Audio_PlayAmbience(play->sequenceCtx.ambienceId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -455,29 +453,27 @@ void func_800EADB0(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
|
||||
break;
|
||||
|
||||
case 4:
|
||||
// func_801A246C(SEQ_PLAYER_NATURE, TYPE_1);
|
||||
func_801A246C(SEQ_PLAYER_NATURE, 1);
|
||||
// func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_1);
|
||||
func_801A246C(SEQ_PLAYER_AMBIENCE, 1);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
// func_801A246C(SEQ_PLAYER_NATURE, TYPE_0);
|
||||
func_801A246C(SEQ_PLAYER_NATURE, 0);
|
||||
// func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_0);
|
||||
func_801A246C(SEQ_PLAYER_AMBIENCE, 0);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
// func_801A246C(SEQ_PLAYER_NATURE, TYPE_2);
|
||||
func_801A246C(SEQ_PLAYER_NATURE, 2);
|
||||
// func_801A246C(SEQ_PLAYER_AMBIENCE, TYPE_2);
|
||||
func_801A246C(SEQ_PLAYER_AMBIENCE, 2);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
// Audio_GetActiveSequence
|
||||
seqId = func_801A8A50(0);
|
||||
seqId = Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
if (seqId != NA_BGM_DISABLED) {
|
||||
// Audio_PlayBgmForDayScene
|
||||
func_801A25E4(seqId, dayMinusOne);
|
||||
Audio_PlaySceneSequence(seqId, dayMinusOne);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -647,7 +643,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB
|
||||
// Command 0x15F: Chooses between a cutscene or a rotating mask depending on whether the player has the corresponding
|
||||
// mask
|
||||
void Cutscene_Command_ChooseCreditsScenes(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
|
||||
if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(0, true) != 0xFF)) {
|
||||
if ((csCtx->frames >= cmd->startFrame) && (func_801A3950(SEQ_PLAYER_BGM_MAIN, true) != 0xFF)) {
|
||||
switch (cmd->base) {
|
||||
case 1:
|
||||
Cutscene_TerminatorImpl(play, csCtx, cmd);
|
||||
|
||||
@@ -46,8 +46,8 @@ void GameOver_Update(PlayState* play) {
|
||||
|
||||
gSaveContext.unk_3DC0 = 2000;
|
||||
gSaveContext.save.playerData.tatlTimer = 0;
|
||||
gSaveContext.seqIndex = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.nightSeqIndex = 0xFF;
|
||||
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
|
||||
gSaveContext.ambienceId = AMBIENCE_ID_DISABLED;
|
||||
gSaveContext.eventInf[0] = 0;
|
||||
gSaveContext.eventInf[1] = 0;
|
||||
gSaveContext.eventInf[2] = 0;
|
||||
@@ -67,7 +67,7 @@ void GameOver_Update(PlayState* play) {
|
||||
gameOverCtx->state = GAMEOVER_DEATH_WAIT_GROUND;
|
||||
break;
|
||||
case GAMEOVER_DEATH_FADE_OUT:
|
||||
if (func_801A8A50(1) != NA_BGM_GAME_OVER) {
|
||||
if (Audio_GetActiveSequence(SEQ_PLAYER_FANFARE) != NA_BGM_GAME_OVER) {
|
||||
func_80169F78(&play->state);
|
||||
if (gSaveContext.respawnFlag != -7) {
|
||||
gSaveContext.respawnFlag = -6;
|
||||
|
||||
+5
-4
@@ -436,11 +436,12 @@ void Scene_HeaderCmd09(PlayState* play, SceneCmd* cmd) {
|
||||
|
||||
// SceneTableEntry Header Command 0x15: Sound Settings=
|
||||
void Scene_HeaderCmdSoundSettings(PlayState* play, SceneCmd* cmd) {
|
||||
play->soundCtx.seqIndex = cmd->soundSettings.musicSeq;
|
||||
play->soundCtx.nightSeqIndex = cmd->soundSettings.nighttimeSFX;
|
||||
play->sequenceCtx.seqId = cmd->soundSettings.seqId;
|
||||
play->sequenceCtx.ambienceId = cmd->soundSettings.ambienceId;
|
||||
|
||||
if (gSaveContext.seqIndex == (u8)NA_BGM_DISABLED || func_801A8A50(0) == NA_BGM_FINAL_HOURS) {
|
||||
audio_setBGM(cmd->soundSettings.bgmId);
|
||||
if (gSaveContext.seqId == (u8)NA_BGM_DISABLED ||
|
||||
Audio_GetActiveSequence(SEQ_PLAYER_BGM_MAIN) == NA_BGM_FINAL_HOURS) {
|
||||
Audio_SetSpec(cmd->soundSettings.specId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user