1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16: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:
Muhammad Rifqi Priyo Susanto 2023-12-11 01:11:39 +07:00 committed by GitHub
parent 321bcf5c44
commit 55fafb7d25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 38 additions and 14 deletions

View file

@ -184,3 +184,9 @@ public:
void fadeSound(sound_handle_t sound, f32 step, f32 target_gain) override {}
void updateSoundPosVel(sound_handle_t sound, const v3f &pos, const v3f &vel) override {}
};
/**
* A helper function to control sound volume based on some values: sound volume
* settings, mute sound setting, and window activity.
*/
void sound_volume_control(ISoundManager *sound_mgr, bool is_window_active);