Revert "Nix'd midimusicvolume", don't know what I want to do with this yet

This reverts commit b5c3095820.

# Conflicts:
#	src/i_sound.h
#	src/s_sound.c
#	src/s_sound.h
#	src/sdl/mixer_sound.c
This commit is contained in:
mazmazz 2018-08-23 09:06:13 -04:00
parent e42defa299
commit 7efab8b314
7 changed files with 56 additions and 10 deletions

View File

@ -1212,7 +1212,7 @@ void D_SRB2Main(void)
}
I_StartupSound();
I_InitMusic();
S_Init(cv_soundvolume.value, cv_digmusicvolume.value);
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();

View File

@ -790,6 +790,7 @@ void D_RegisterClientCommands(void)
CV_RegisterVar(&cv_soundvolume);
CV_RegisterVar(&cv_closedcaptioning);
CV_RegisterVar(&cv_digmusicvolume);
CV_RegisterVar(&cv_midimusicvolume);
CV_RegisterVar(&cv_numChannels);
// i_cdmus.c
@ -4057,6 +4058,7 @@ static void Command_RestartAudio_f(void)
I_SetSfxVolume(cv_soundvolume.value);
I_SetDigMusicVolume(cv_digmusicvolume.value);
I_SetMIDIMusicVolume(cv_midimusicvolume.value);
if (Playing()) // Gotta make sure the player is in a level
P_RestoreMusic(&players[consoleplayer]);

View File

@ -136,6 +136,14 @@ void I_ResumeSong(INT32 handle);
// MIDI I/O
//
/** \brief The I_SetMIDIMusicVolume function
\param volume volume to set at
\return void
*/
void I_SetMIDIMusicVolume(UINT8 volume);
/** \brief Registers a song handle to song data.
\param data pointer to song data

View File

@ -1314,6 +1314,9 @@ static menuitem_t OP_SoundOptionsMenu[] =
{IT_STRING | IT_KEYHANDLER, NULL, "Digital Music", M_ToggleDigital, 40},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Digital Music Volume", &cv_digmusicvolume, 50},
{IT_STRING | IT_KEYHANDLER, NULL, "MIDI Music", M_ToggleMIDI, 70},
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "MIDI Music Volume", &cv_midimusicvolume, 80},
{IT_STRING | IT_CVAR, NULL, "Closed Captioning", &cv_closedcaptioning, 100},
};
@ -9418,7 +9421,7 @@ static void M_ToggleSFX(INT32 choice)
nosound = false;
I_StartupSound();
if (nosound) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value);
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_StartSound(NULL, sfx_strpst);
OP_SoundOptionsMenu[6].status = IT_STRING | IT_CVAR;
//M_StartMessage(M_GetText("SFX Enabled\n"), NULL, MM_NOTHING);
@ -9471,7 +9474,7 @@ static void M_ToggleDigital(INT32 choice)
nodigimusic = false;
I_InitMusic();
if (nodigimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value);
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
S_StopMusic();
if (Playing())
P_RestoreMusic(&players[consoleplayer]);
@ -9528,7 +9531,7 @@ static void M_ToggleMIDI(INT32 choice)
nomidimusic = false;
I_InitMusic();
if (nomidimusic) return;
S_Init(cv_soundvolume.value, cv_digmusicvolume.value);
S_Init(cv_soundvolume.value, cv_digmusicvolume.value, cv_midimusicvolume.value);
if (Playing())
P_RestoreMusic(&players[consoleplayer]);
else

View File

@ -77,6 +77,7 @@ static consvar_t precachesound = {"precachesound", "Off", CV_SAVE, CV_OnOff, NUL
// actual general (maximum) sound & music volume, saved into the config
consvar_t cv_soundvolume = {"soundvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_digmusicvolume = {"digmusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
consvar_t cv_midimusicvolume = {"midimusicvolume", "18", CV_SAVE, soundvolume_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
static void Captioning_OnChange(void)
{
@ -787,6 +788,7 @@ void S_StopSound(void *origin)
//
static INT32 actualsfxvolume; // check for change through console
static INT32 actualdigmusicvolume;
static INT32 actualmidimusicvolume;
void S_UpdateSounds(void)
{
@ -807,7 +809,9 @@ void S_UpdateSounds(void)
if (actualsfxvolume != cv_soundvolume.value)
S_SetSfxVolume (cv_soundvolume.value);
if (actualdigmusicvolume != cv_digmusicvolume.value)
S_SetMusicVolume (cv_digmusicvolume.value);
S_SetDigMusicVolume (cv_digmusicvolume.value);
if (actualmidimusicvolume != cv_midimusicvolume.value)
S_SetMIDIMusicVolume (cv_midimusicvolume.value);
// We're done now, if we're not in a level.
if (gamestate != GS_LEVEL)
@ -1444,6 +1448,20 @@ void S_SetMusicVolume(INT32 volume)
I_SetDigMusicVolume(volume&31);
}
void S_SetMIDIMusicVolume(INT32 volume)
{
if (volume < 0 || volume > 31)
CONS_Alert(CONS_WARNING, "musicvolume should be between 0-31\n");
CV_SetValue(&cv_midimusicvolume, volume&0x1f);
actualmidimusicvolume = cv_midimusicvolume.value; //check for change of var
#ifdef DJGPPDOS
I_SetMIDIMusicVolume(31); // Trick for buggy dos drivers. Win32 doesn't need this.
#endif
I_SetMIDIMusicVolume(volume&0x1f);
}
/// ------------------------
/// Init & Others
/// ------------------------
@ -1453,7 +1471,7 @@ void S_SetMusicVolume(INT32 volume)
// Sets channels, SFX and music volume,
// allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume)
void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume)
{
INT32 i;
@ -1461,7 +1479,8 @@ void S_Init(INT32 sfxVolume, INT32 digMusicVolume)
return;
S_SetSfxVolume(sfxVolume);
S_SetMusicVolume(digMusicVolume);
S_SetDigMusicVolume(digMusicVolume);
S_SetMIDIMusicVolume(midiMusicVolume);
SetChannelsNum();

View File

@ -23,7 +23,7 @@
#define PICKUP_SOUND 0x8000
extern consvar_t stereoreverse;
extern consvar_t cv_soundvolume, cv_closedcaptioning, cv_digmusicvolume;
extern consvar_t cv_soundvolume, cv_closedcaptioning, cv_digmusicvolume, cv_midimusicvolume;
extern consvar_t cv_numChannels;
#ifdef SNDSERV
@ -99,7 +99,7 @@ void S_RegisterSoundStuff(void);
// Initializes sound stuff, including volume
// Sets channels, SFX and music volume, allocates channel buffer, sets S_sfx lookup.
//
void S_Init(INT32 sfxVolume, INT32 digMusicVolume);
void S_Init(INT32 sfxVolume, INT32 digMusicVolume, INT32 midiMusicVolume);
//
// Per level startup code.
@ -149,7 +149,8 @@ void S_UpdateSounds(void);
FUNCMATH fixed_t S_CalculateSoundDistance(fixed_t px1, fixed_t py1, fixed_t pz1, fixed_t px2, fixed_t py2, fixed_t pz2);
void S_SetMusicVolume(INT32 volume);
void S_SetDigMusicVolume(INT32 volume);
void S_SetMIDIMusicVolume(INT32 volume);
void S_SetSfxVolume(INT32 volume);
INT32 S_OriginPlaying(void *origin);

View File

@ -764,6 +764,19 @@ void I_StopSong(void)
music = NULL;
}
void I_SetMIDIMusicVolume(UINT8 volume)
{
// HACK: Until we stop using native MIDI,
// disable volume changes
(void)volume;
midi_volume = 31;
//midi_volume = volume;
if (!midimode || !music)
return;
Mix_VolumeMusic((UINT32)midi_volume*128/31);
}
void I_UnloadSong(void)
{
if (!midimode || !music)