From 3ec1a122e0165112c772b0d62a7aa68d7218a3cf Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 23 Aug 2018 09:09:12 -0400 Subject: [PATCH] Revert "Nix'd midimusicvolume other targets" This reverts commit 58fbb4636f4a3dc940e31d6cce94e87dcd0dbaa7. # Conflicts: # src/android/i_sound.c # src/dummy/i_sound.c # src/win32/win_snd.c --- src/android/i_sound.c | 5 +++++ src/djgppdos/i_sound.c | 11 ++++++++++- src/dummy/i_sound.c | 5 +++++ src/sdl/sdl_sound.c | 27 ++++++++++++++++----------- src/win32/win_cd.c | 1 + src/win32/win_snd.c | 8 ++++++++ 6 files changed, 45 insertions(+), 12 deletions(-) diff --git a/src/android/i_sound.c b/src/android/i_sound.c index 109faf57d..744067623 100644 --- a/src/android/i_sound.c +++ b/src/android/i_sound.c @@ -87,6 +87,11 @@ boolean I_LoadSong(void *data, size_t len) return -1; } +void I_SetMIDIMusicVolume(INT32 volume) +{ + (void)volume; +} + boolean I_PlaySong(void) { (void)handle; diff --git a/src/djgppdos/i_sound.c b/src/djgppdos/i_sound.c index 993e164c9..a0ad28553 100644 --- a/src/djgppdos/i_sound.c +++ b/src/djgppdos/i_sound.c @@ -140,6 +140,15 @@ void I_SetSfxVolume(INT32 volume) set_volume (Volset(volume),-1); } +void I_SetMIDIMusicVolume(INT32 volume) +{ + if (nomidimusic) + return; + + // Now set volume on output device. + set_volume (-1, Volset(volume)); +} + // // Starting a sound means adding it // to the current list of active sounds @@ -494,7 +503,7 @@ void I_SetDigMusicVolume(INT32 volume) return; // Now set volume on output device. - set_volume (-1, Volset(volume)); +// CONS_Printf("Digital music not yet supported under DOS.\n"); } boolean I_SetSongSpeed(float speed) diff --git a/src/dummy/i_sound.c b/src/dummy/i_sound.c index ef186d5f3..a70dcef83 100644 --- a/src/dummy/i_sound.c +++ b/src/dummy/i_sound.c @@ -65,6 +65,11 @@ void I_InitMusic(void){} void I_ShutdownMusic(void){} +void I_SetMIDIMusicVolume(UINT8 volume) +{ + (void)volume; +} + void I_PauseSong(INT32 handle) { (void)handle; diff --git a/src/sdl/sdl_sound.c b/src/sdl/sdl_sound.c index fb4c301ae..c1badfe65 100644 --- a/src/sdl/sdl_sound.c +++ b/src/sdl/sdl_sound.c @@ -1679,6 +1679,21 @@ boolean I_LoadSong(void *data, size_t len) return false; } +void I_SetMIDIMusicVolume(UINT8 volume) +{ +#ifdef HAVE_MIXER + if ((nomidimusic && nodigimusic) || !musicStarted) + return; + + if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); + musicvol = volume * 2; + if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); + Mix_VolumeMusic(musicvol); +#else + (void)volume; +#endif +} + #ifdef HAVE_LIBGME static void I_CleanupGME(void *userdata) { @@ -1915,17 +1930,7 @@ static void I_StopGME(void) void I_SetDigMusicVolume(UINT8 volume) { -#ifdef HAVE_MIXER - if ((nomidimusic && nodigimusic) || !musicStarted) - return; - - if (Msc_Mutex) SDL_LockMutex(Msc_Mutex); - musicvol = volume * 2; - if (Msc_Mutex) SDL_UnlockMutex(Msc_Mutex); - Mix_VolumeMusic(musicvol); -#else - (void)volume; -#endif + I_SetMIDIMusicVolume(volume); } boolean I_SetSongSpeed(float speed) diff --git a/src/win32/win_cd.c b/src/win32/win_cd.c index 2278fbdda..f6c430748 100644 --- a/src/win32/win_cd.c +++ b/src/win32/win_cd.c @@ -470,6 +470,7 @@ void I_PlayCD(UINT8 nTrack, UINT8 bLooping) //faB: stop MIDI music, MIDI music will restart if volume is upped later cv_digmusicvolume.value = 0; + cv_midimusicvolume.value = 0; I_StopSong (0); //faB: I don't use the notify message, I'm trying to minimize the delay diff --git a/src/win32/win_snd.c b/src/win32/win_snd.c index 559feb2ae..c49be100d 100644 --- a/src/win32/win_snd.c +++ b/src/win32/win_snd.c @@ -775,6 +775,14 @@ boolean I_SetSongTrack(INT32 track) // Fuck MIDI. ... Okay fine, you can have your silly D_-only mode. // +void I_SetMIDIMusicVolume(UINT8 volume) +{ + // volume is 0 to 31. + midi_volume = volume; + if (midimode && music_stream) + FMR_MUSIC(FMOD_Channel_SetVolume(music_channel, volume / 31.0)); +} + boolean I_PlaySong(void) { #ifdef HAVE_LIBGME