engine: client: mute music if not in focus

This commit is contained in:
Alibek Omarov 2024-06-17 20:32:04 +03:00
parent 260edc2a08
commit 03c8ea14cc

View file

@ -57,6 +57,12 @@ float S_GetMusicVolume( void )
{ {
float scale = 1.0f; float scale = 1.0f;
if( host.status == HOST_NOFOCUS && snd_mute_losefocus.value != 0.0f )
{
// we return zero volume to keep sounds running
return 0.0f;
}
if( !s_listener.inmenu && musicfade.percent != 0 ) if( !s_listener.inmenu && musicfade.percent != 0 )
{ {
scale = bound( 0.0f, musicfade.percent / 100.0f, 1.0f ); scale = bound( 0.0f, musicfade.percent / 100.0f, 1.0f );