@@ -12,8 +12,7 @@ static EWRAM_DATA u16 sFanfareMusicPlayerState = {0};
12
12
static EWRAM_DATA u16 sMusicTransitionCounter = {0 };
13
13
static EWRAM_DATA bool8 sRestartBGM = {0 };
14
14
15
- static IWRAM_DATA PMDMusicPlayer sBGMusicPlayers [NUM_BG_PLAYERS ] = {0 };
16
- static IWRAM_DATA PMDMusicPlayer sSEMusicPlayers [NUM_SE_PLAYERS ] = {0 };
15
+ static IWRAM_DATA PMDMusicPlayer sMusicPlayers [MUSIC_PLAYERS_COUNT ] = {0 };
17
16
18
17
static u16 GetMusicPlayerIndex (u16 songIndex );
19
18
static bool8 IsBGSong (u32 songIndex );
@@ -46,7 +45,7 @@ void InitMusic(void)
46
45
sMusicTransitionCounter = 0 ;
47
46
sRestartBGM = FALSE;
48
47
49
- for (playerIndex = INDEX_BGM , musicPlayer = & sBGMusicPlayers [0 ]; playerIndex < INDEX_SE6 + 1 ; playerIndex ++ , musicPlayer ++ ) {
48
+ for (playerIndex = INDEX_BGM , musicPlayer = & sMusicPlayers [0 ]; playerIndex < MUSIC_PLAYERS_COUNT ; playerIndex ++ , musicPlayer ++ ) {
50
49
musicPlayer -> unk0 = 0 ;
51
50
musicPlayer -> songIndex = STOP_SOUND_EFFECT ;
52
51
musicPlayer -> volume = 0 ;
@@ -274,7 +273,7 @@ void PlayFanfareSE(u16 songIndex, u16 volume)
274
273
return ;
275
274
276
275
playerIndex = GetMusicPlayerIndex (songIndex );
277
- musicPlayer = & sBGMusicPlayers [playerIndex ]; // need to load this before comparison to match
276
+ musicPlayer = & sMusicPlayers [playerIndex ]; // need to load this before comparison to match
278
277
279
278
if (playerIndex < INDEX_SE1 )
280
279
nullsub_20 (songIndex );
@@ -310,7 +309,7 @@ UNUSED static void SetSoundEffectVolume(u16 songIndex, u16 volume)
310
309
if (!IsFanfare (songIndex ) && IsSoundEffect (songIndex )) {
311
310
playerIndex = GetMusicPlayerIndex (songIndex );
312
311
info = gMPlayTable [playerIndex ].info ;
313
- musicPlayer = & sBGMusicPlayers [playerIndex ];
312
+ musicPlayer = & sMusicPlayers [playerIndex ];
314
313
if (playerIndex >= INDEX_SE1 ) {
315
314
interruptFlag = DisableInterrupts ();
316
315
if (musicPlayer -> songIndex == songIndex )
@@ -329,7 +328,7 @@ void StopFanfareSE(u16 songIndex)
329
328
PMDMusicPlayer * musicPlayer ;
330
329
bool8 interruptFlag = DisableInterrupts ();
331
330
332
- for (playerIndex = INDEX_SE1 , musicPlayer = & sSEMusicPlayers [ 0 ]; playerIndex < INDEX_SE6 ; playerIndex ++ , musicPlayer ++ ) {
331
+ for (playerIndex = INDEX_SE1 , musicPlayer = & sMusicPlayers [ INDEX_SE1 ]; playerIndex < INDEX_SE6 ; playerIndex ++ , musicPlayer ++ ) {
333
332
m4aMPlayStop (gMPlayTable [playerIndex ].info );
334
333
musicPlayer -> unk0 = 0 ;
335
334
musicPlayer -> songIndex = STOP_SOUND_EFFECT ;
@@ -343,7 +342,7 @@ void StopFanfareSE(u16 songIndex)
343
342
else if (IsSoundEffect (songIndex )) {
344
343
u32 playerIndex = GetMusicPlayerIndex (songIndex );
345
344
struct MusicPlayerInfo * info = gMPlayTable [playerIndex ].info ;
346
- PMDMusicPlayer * musicPlayer = & sBGMusicPlayers [playerIndex ];
345
+ PMDMusicPlayer * musicPlayer = & sMusicPlayers [playerIndex ];
347
346
348
347
if (playerIndex < INDEX_SE1 )
349
348
nullsub_21 (songIndex );
@@ -406,7 +405,7 @@ void FadeOutFanfareSE(u16 songIndex, u16 speed)
406
405
PMDMusicPlayer * musicPlayer ;
407
406
bool8 interruptFlag = DisableInterrupts ();
408
407
409
- for (playerIndex = INDEX_SE1 , musicPlayer = & sSEMusicPlayers [ 0 ]; playerIndex < INDEX_SE6 ; playerIndex ++ , musicPlayer ++ ) {
408
+ for (playerIndex = INDEX_SE1 , musicPlayer = & sMusicPlayers [ INDEX_SE1 ]; playerIndex < INDEX_SE6 ; playerIndex ++ , musicPlayer ++ ) {
410
409
if (musicPlayer -> songIndex != STOP_SOUND_EFFECT ) {
411
410
if (IsMusicPlayerPlaying (playerIndex ))
412
411
m4aMPlayFadeOut (gMPlayTable [playerIndex ].info , speed );
@@ -425,7 +424,7 @@ void FadeOutFanfareSE(u16 songIndex, u16 speed)
425
424
}
426
425
else if (IsSoundEffect (songIndex )) {
427
426
s32 playerIndex = GetMusicPlayerIndex (songIndex );
428
- PMDMusicPlayer * musicPlayer = & sBGMusicPlayers [playerIndex ];
427
+ PMDMusicPlayer * musicPlayer = & sMusicPlayers [playerIndex ];
429
428
struct MusicPlayerInfo * playerInfo = gMPlayTable [playerIndex ].info ;
430
429
bool8 interruptFlag = DisableInterrupts ();
431
430
@@ -487,7 +486,7 @@ bool8 IsFanfareSEPlaying(u16 songIndex)
487
486
}
488
487
else if (IsSoundEffect (songIndex )) {
489
488
playerIndex = GetMusicPlayerIndex (songIndex );
490
- musicPlayer = & sBGMusicPlayers [playerIndex ];
489
+ musicPlayer = & sMusicPlayers [playerIndex ];
491
490
if (INDEX_SE1 > playerIndex )
492
491
return FALSE;
493
492
if (musicPlayer -> songIndex == songIndex )
@@ -622,7 +621,7 @@ void UpdateSound(void)
622
621
}
623
622
}
624
623
625
- for (musicPlayerIndex = INDEX_SE1 , musicPlayer = & sSEMusicPlayers [ 0 ]; musicPlayerIndex < INDEX_SE6 ; musicPlayerIndex ++ , musicPlayer ++ ) {
624
+ for (musicPlayerIndex = INDEX_SE1 , musicPlayer = & sMusicPlayers [ INDEX_SE1 ]; musicPlayerIndex < INDEX_SE6 ; musicPlayerIndex ++ , musicPlayer ++ ) {
626
625
if (musicPlayer -> songIndex != STOP_SOUND_EFFECT ) {
627
626
switch (musicPlayer -> unk0 ){
628
627
case 1 :
0 commit comments