mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +00:00
Add sound volume when unfocused setting (#14083)
This adds a new setting to set sound volume multiplier when Minetest window is unfocused/inactive (sound_volume_unfocused, located in Settings > Graphics and Audio > Audio > Volume when unfocused). If the window is not focused, the sound volume will be multiplied by sound_volume_unfocused setting. The sound volume will be set back to sound_volume again when the window is focused.
This commit is contained in:
parent
321bcf5c44
commit
55fafb7d25
6 changed files with 38 additions and 14 deletions
|
@ -23,7 +23,6 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include <ICameraSceneNode.h>
|
||||
#include "client/renderingengine.h"
|
||||
#include "scripting_mainmenu.h"
|
||||
#include "util/numeric.h"
|
||||
#include "config.h"
|
||||
#include "version.h"
|
||||
#include "porting.h"
|
||||
|
@ -296,6 +295,7 @@ void GUIEngine::run()
|
|||
driver->endScene();
|
||||
|
||||
IrrlichtDevice *device = m_rendering_engine->get_raw_device();
|
||||
|
||||
u32 frametime_min = 1000 / (device->isWindowFocused()
|
||||
? g_settings->getFloat("fps_max")
|
||||
: g_settings->getFloat("fps_max_unfocused"));
|
||||
|
@ -310,6 +310,8 @@ void GUIEngine::run()
|
|||
|
||||
m_script->step();
|
||||
|
||||
sound_volume_control(m_sound_manager.get(), device->isWindowActive());
|
||||
|
||||
m_sound_manager->step(dtime);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue