diff --git a/include/config/config_audio.h b/include/config/config_audio.h index 332e09b3..a65b1818 100644 --- a/include/config/config_audio.h +++ b/include/config/config_audio.h @@ -28,3 +28,8 @@ * Reverb parameters can be configured in audio/synthesis.c to meet desired aesthetic/performance needs. Currently US/JP only. Hurts emulator and console performance. */ // #define BETTER_REVERB + +/** + * Do not restart the music on cap grabs + */ +#define PERSISTENT_CAP_MUSIC diff --git a/src/audio/external.c b/src/audio/external.c index 7f77c613..95b9423e 100644 --- a/src/audio/external.c +++ b/src/audio/external.c @@ -15,6 +15,8 @@ #include "seq_ids.h" #include "dialog_ids.h" +#include "config/config_audio.h" + // N.B. sound banks are different from the audio banks referred to in other // files. We should really fix our naming to be less ambiguous... #define MAX_BACKGROUND_MUSIC_QUEUE_SIZE 6 @@ -2195,7 +2197,9 @@ void play_music(u8 player, u16 seqArgs, u16 fadeTimer) { for (i = 0; i < sBackgroundMusicQueueSize; i++) { if (sBackgroundMusicQueue[i].seqId == seqId) { if (i == 0) { +#ifndef PERSISTENT_CAP_MUSIC seq_player_play_sequence(SEQ_PLAYER_LEVEL, seqId, fadeTimer); +#endif } else if (!gSequencePlayers[SEQ_PLAYER_LEVEL].enabled) { stop_background_music(sBackgroundMusicQueue[0].seqId); } diff --git a/src/game/sound_init.c b/src/game/sound_init.c index db5c3213..beed9f67 100644 --- a/src/game/sound_init.c +++ b/src/game/sound_init.c @@ -16,6 +16,8 @@ #include "rumble_init.h" #include "puppyprint.h" +#include "config/config_audio.h" + #define MUSIC_NONE 0xFFFF static OSMesgQueue sSoundMesgQueue; @@ -293,7 +295,20 @@ void stop_shell_music(void) { /** * Called from threads: thread5_game_loop */ + +#ifdef PERSISTENT_CAP_MUSIC +static s8 sDoResetMusic = FALSE; +extern void stop_cap_music(void); +#endif + void play_cap_music(u16 seqArgs) { +#ifdef PERSISTENT_CAP_MUSIC + if (sDoResetMusic) { + sDoResetMusic = FALSE; + stop_cap_music(); + } +#endif + play_music(SEQ_PLAYER_LEVEL, seqArgs, 0); if (sCurrentCapMusic != MUSIC_NONE && sCurrentCapMusic != seqArgs) { stop_background_music(sCurrentCapMusic); @@ -307,6 +322,9 @@ void play_cap_music(u16 seqArgs) { void fadeout_cap_music(void) { if (sCurrentCapMusic != MUSIC_NONE) { fadeout_background_music(sCurrentCapMusic, 600); +#ifdef PERSISTENT_CAP_MUSIC + sDoResetMusic = TRUE; +#endif } }