X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsound.c;h=ea055503cbaa0204a18f0c8ba6e88b8b8fe8a82c;hb=7b3991f74b0e0dc6774453a59e674696560c2d93;hp=cb788e7e573769a7efeec3e8ff1fbeaec7692fc3;hpb=8d71e6fb8309bd90ce5f2900d84c686b17950492;p=rocksndiamonds.git diff --git a/src/libgame/sound.c b/src/libgame/sound.c index cb788e7e..ea055503 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -225,6 +225,16 @@ static void Mixer_PlayMusicChannel() // (this may happen when switching on music while playing the game) Mix_VolumeMusic(mixer[audio.music_channel].volume); Mix_FadeInMusic(mixer[audio.music_channel].data_ptr, -1, 100); + +#if defined(PLATFORM_WIN32) + // playing MIDI music is broken since Windows Vista, as it sets the volume + // for MIDI music also for all other sounds and music, which cannot be set + // back to normal unless playing MIDI music again with that desired volume + // (more details: https://www.artsoft.org/forum/viewtopic.php?f=7&t=2253) + // => workaround: always play MIDI music with maximum volume + if (Mix_GetMusicType(NULL) == MUS_MID) + Mix_VolumeMusic(SOUND_MAX_VOLUME); +#endif } } @@ -264,6 +274,16 @@ static void Mixer_FadeMusicChannel() Mix_FadeOutMusic(SOUND_FADING_INTERVAL); +#if defined(PLATFORM_WIN32) + // playing MIDI music is broken since Windows Vista, as it sets the volume + // for MIDI music also for all other sounds and music, which cannot be set + // back to normal unless playing MIDI music again with that desired volume + // (more details: https://www.artsoft.org/forum/viewtopic.php?f=7&t=2253) + // => workaround: never fade MIDI music to lower volume, but just stop it + if (Mix_GetMusicType(NULL) == MUS_MID) + Mixer_StopMusicChannel(); +#endif + setString(¤tly_playing_music_filename, NULL); } @@ -705,6 +725,16 @@ static MusicInfo *getMusicInfoEntryFromMusicID(int pos) return mus_info[list_pos]; } +char *getMusicInfoEntryFilename(int pos) +{ + MusicInfo *mus_info = getMusicInfoEntryFromMusicID(pos); + + if (mus_info == NULL) + return NULL; + + return getBaseNamePtr(mus_info->source_filename); +} + char *getCurrentlyPlayingMusicFilename() { return currently_playing_music_filename;