Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Heretic & Hexen: Fix bug with "Mute inactive window" option #453

Merged
merged 1 commit into from
Feb 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/heretic/s_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -817,9 +817,14 @@ void S_SetMaxVolume(boolean fullprocess)
}
}

static boolean musicPaused;
static boolean musicPaused = false;
static boolean sound_muted = false;
void S_SetMusicVolume(void)
{
if(sound_muted)
{
return;
}
I_SetMusicVolume(snd_MusicVolume);
if (snd_MusicVolume == 0)
{
Expand Down Expand Up @@ -862,6 +867,7 @@ void S_MuteSound(void)
}

volume_needs_update = false;
sound_muted = true;
}

// -----------------------------------------------------------------------------
Expand All @@ -877,4 +883,5 @@ void S_UnMuteSound(void)
S_SetMaxVolume(true);

volume_needs_update = false;
sound_muted = false;
}
9 changes: 8 additions & 1 deletion src/hexen/s_sound.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void S_StartSong(int song, boolean loop)

RegisteredSong = I_RegisterSong(Mus_SndPtr, length);
// [JN] Set proper music volume.
I_SetMusicVolume(snd_MusicVolume);
S_SetMusicVolume();
I_PlaySong(RegisteredSong, loop);
Mus_Song = song;

Expand Down Expand Up @@ -1020,8 +1020,13 @@ boolean S_GetSoundPlayingInfo(mobj_t * mobj, int sound_id)
//
//==========================================================================

static boolean sound_muted = false;
void S_SetMusicVolume(void)
{
if(sound_muted)
{
return;
}
if (cdmusic)
{
I_CDMusSetVolume(snd_MusicVolume * 16); // 0-255
Expand Down Expand Up @@ -1077,6 +1082,7 @@ void S_MuteSound(void)
S_StopAllSound();

volume_needs_update = false;
sound_muted = true;
}

// -----------------------------------------------------------------------------
Expand All @@ -1091,6 +1097,7 @@ void S_UnMuteSound(void)
snd_MaxVolume = snd_MaxVolume_tmp;

volume_needs_update = false;
sound_muted = false;
}

//==========================================================================
Expand Down