mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Limit properly the sound setting at updateSound runtime step (#5753)
* Limit properly the sound setting at updateSound runtime step Fix #5026 * Add a comment
This commit is contained in:
parent
9b8ca3a746
commit
6673aff685
2 changed files with 11 additions and 4 deletions
10
src/game.cpp
10
src/game.cpp
|
@ -3444,7 +3444,15 @@ void Game::updateSound(f32 dtime)
|
|||
v3f(0, 0, 0), // velocity
|
||||
camera->getDirection(),
|
||||
camera->getCameraNode()->getUpVector());
|
||||
sound->setListenerGain(g_settings->getFloat("sound_volume"));
|
||||
|
||||
// Check if volume is in the proper range, else fix it.
|
||||
float old_volume = g_settings->getFloat("sound_volume");
|
||||
float new_volume = rangelim(old_volume, 0.0f, 1.0f);
|
||||
sound->setListenerGain(new_volume);
|
||||
|
||||
if (old_volume != new_volume) {
|
||||
g_settings->setFloat("sound_volume", new_volume);
|
||||
}
|
||||
|
||||
LocalPlayer *player = client->getEnv().getLocalPlayer();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue