static int num_music_noconf = 0;
static int stereo_volume[SOUND_MAX_LEFT2RIGHT + 1];
+static char *currently_playing_music_filename = NULL;
+
/* ========================================================================= */
/* THE STUFF BELOW IS ONLY USED BY THE SOUND SERVER CHILD PROCESS */
Mixer_StopChannel(audio.music_channel);
Mix_HaltMusic();
+
+ setString(¤tly_playing_music_filename, NULL);
}
static void Mixer_FadeChannel(int channel)
Mixer_FadeChannel(audio.music_channel);
Mix_FadeOutMusic(SOUND_FADING_INTERVAL);
+
+ setString(¤tly_playing_music_filename, NULL);
}
static void Mixer_UnFadeChannel(int channel)
mixer[audio.music_channel] = snd_ctrl;
Mixer_PlayMusicChannel();
+ setString(¤tly_playing_music_filename,
+ getBaseNamePtr(snd_info->source_filename));
+
return;
}
return mus_info[list_pos];
}
+char *getCurrentlyPlayingMusicFilename()
+{
+ return currently_playing_music_filename;
+}
+
int getSoundListPropertyMappingSize()
{
return sound_info->num_property_mapping_entries;
int getMusicListSize();
struct FileInfo *getSoundListEntry(int);
struct FileInfo *getMusicListEntry(int);
+char *getCurrentlyPlayingMusicFilename();
int getSoundListPropertyMappingSize();
int getMusicListPropertyMappingSize();
struct PropertyMapping *getSoundListPropertyMapping();
void PlayMenuMusic()
{
- PlayMenuMusicExt(menu.music[game_status]);
+ char *curr_music = getCurrentlyPlayingMusicFilename();
+ char *next_music = getMusicListEntry(menu.music[game_status])->filename;
+
+ if (!strEqual(curr_music, next_music))
+ PlayMenuMusicExt(menu.music[game_status]);
}
void PlayMenuSoundsAndMusic()
PlayMenuMusic();
}
+static void FadeMenuSounds()
+{
+ FadeSounds();
+}
+
+static void FadeMenuMusic()
+{
+ char *curr_music = getCurrentlyPlayingMusicFilename();
+ char *next_music = getMusicListEntry(menu.music[game_status])->filename;
+
+ if (!strEqual(curr_music, next_music))
+ FadeMusic();
+}
+
void FadeMenuSoundsAndMusic()
{
- FadeSoundsAndMusic();
+ FadeMenuSounds();
+ FadeMenuMusic();
}
void PlaySoundActivating()