Added no cap music restarts define (#335)

This commit is contained in:
Denis Kopyrin
2022-03-20 21:48:40 +08:00
committed by GitHub
parent cc92b33676
commit 3ac257e6fb
3 changed files with 27 additions and 0 deletions

View File

@@ -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

View File

@@ -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);
}

View File

@@ -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
}
}