Skip to content

Commit 14ca523

Browse files
committed
CClientSoundManager: make sure master volume is used
1 parent ba0540c commit 14ca523

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Client/mods/deathmatch/logic/CClientPlayerVoice.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ CClientPlayerVoice::CClientPlayerVoice(CClientPlayer* pPlayer, CVoiceRecorder* p
3535
// Get initial voice volume
3636
m_fVolume = 1.0f;
3737
g_pCore->GetCVars()->Get("voicevolume", m_fVolumeScale);
38-
m_fVolumeScale *= g_pCore->GetCVars()->GetValue<float>("mastervolume");
38+
m_fVolumeScale *= g_pCore->GetCVars()->GetValue<float>("mastervolume", 1.0f);
3939

4040
m_fVolume = m_fVolume * m_fVolumeScale;
4141

@@ -115,7 +115,7 @@ void CClientPlayerVoice::DoPulse(void)
115115
m_CS.Lock();
116116
float fPreviousVolume = 0.0f;
117117
g_pCore->GetCVars()->Get("voicevolume", fPreviousVolume);
118-
fPreviousVolume *= g_pCore->GetCVars()->GetValue<float>("mastervolume");
118+
fPreviousVolume *= g_pCore->GetCVars()->GetValue<float>("mastervolume", 1.0f);
119119
m_CS.Unlock();
120120

121121
if (fPreviousVolume != m_fVolumeScale && m_pPlayer->IsLocalPlayer() == false)

Client/mods/deathmatch/logic/CClientSoundManager.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,16 @@ int CClientSoundManager::GetFxEffectFromName(const std::string& strEffectName)
258258

259259
void CClientSoundManager::UpdateVolume()
260260
{
261-
// set our mta or master sound volume if the cvar changed
261+
// set our mta sound volume if mtavolume or mastervolume cvar changed
262262
float fValue = 0.0f;
263+
263264
if (!m_bMinimizeMuted)
264265
{
266+
float fMasterVolume = g_pCore->GetCVars()->GetValue<float>("mastervolume", 1.0f);
267+
265268
if (g_pCore->GetCVars()->Get("mtavolume", fValue))
266269
{
267-
fValue *= g_pCore->GetCVars()->GetValue<float>("mastervolume");
270+
fValue *= fMasterVolume;
268271

269272
if (fValue * 10000 == BASS_GetConfig(BASS_CONFIG_GVOL_STREAM))
270273
return;
@@ -273,7 +276,7 @@ void CClientSoundManager::UpdateVolume()
273276
}
274277
else
275278
{
276-
fValue = 1.0f;
279+
fValue = fMasterVolume;
277280
}
278281
}
279282

0 commit comments

Comments
 (0)