Revert "Nix'd midimusicvolume other targets"

This reverts commit 58fbb4636f.

# Conflicts:
#	src/android/i_sound.c
#	src/dummy/i_sound.c
#	src/win32/win_snd.c
This commit is contained in:
mazmazz 2018-08-23 09:09:12 -04:00
parent 75cbfab8c6
commit 3ec1a122e0
6 changed files with 45 additions and 12 deletions

View File

@ -87,6 +87,11 @@ boolean I_LoadSong(void *data, size_t len)
return -1; return -1;
} }
void I_SetMIDIMusicVolume(INT32 volume)
{
(void)volume;
}
boolean I_PlaySong(void) boolean I_PlaySong(void)
{ {
(void)handle; (void)handle;

View File

@ -140,6 +140,15 @@ void I_SetSfxVolume(INT32 volume)
set_volume (Volset(volume),-1); 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 // Starting a sound means adding it
// to the current list of active sounds // to the current list of active sounds
@ -494,7 +503,7 @@ void I_SetDigMusicVolume(INT32 volume)
return; return;
// Now set volume on output device. // 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) boolean I_SetSongSpeed(float speed)

View File

@ -65,6 +65,11 @@ void I_InitMusic(void){}
void I_ShutdownMusic(void){} void I_ShutdownMusic(void){}
void I_SetMIDIMusicVolume(UINT8 volume)
{
(void)volume;
}
void I_PauseSong(INT32 handle) void I_PauseSong(INT32 handle)
{ {
(void)handle; (void)handle;

View File

@ -1679,6 +1679,21 @@ boolean I_LoadSong(void *data, size_t len)
return false; 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 #ifdef HAVE_LIBGME
static void I_CleanupGME(void *userdata) static void I_CleanupGME(void *userdata)
{ {
@ -1915,17 +1930,7 @@ static void I_StopGME(void)
void I_SetDigMusicVolume(UINT8 volume) void I_SetDigMusicVolume(UINT8 volume)
{ {
#ifdef HAVE_MIXER I_SetMIDIMusicVolume(volume);
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
} }
boolean I_SetSongSpeed(float speed) boolean I_SetSongSpeed(float speed)

View File

@ -470,6 +470,7 @@ void I_PlayCD(UINT8 nTrack, UINT8 bLooping)
//faB: stop MIDI music, MIDI music will restart if volume is upped later //faB: stop MIDI music, MIDI music will restart if volume is upped later
cv_digmusicvolume.value = 0; cv_digmusicvolume.value = 0;
cv_midimusicvolume.value = 0;
I_StopSong (0); I_StopSong (0);
//faB: I don't use the notify message, I'm trying to minimize the delay //faB: I don't use the notify message, I'm trying to minimize the delay

View File

@ -775,6 +775,14 @@ boolean I_SetSongTrack(INT32 track)
// Fuck MIDI. ... Okay fine, you can have your silly D_-only mode. // 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) boolean I_PlaySong(void)
{ {
#ifdef HAVE_LIBGME #ifdef HAVE_LIBGME