From c3dd2ab6eb0c03b0aabb2c02d19305feb51cc5a5 Mon Sep 17 00:00:00 2001 From: TimeyDingo Date: Thu, 30 Jul 2026 20:55:32 -0400 Subject: [PATCH 1/2] unclamped gain #2336 --- src/modules/audio/wrap_Source.cpp | 2 +- testing/tests/audio.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/modules/audio/wrap_Source.cpp b/src/modules/audio/wrap_Source.cpp index dbe2f81b1..8ac9eaf88 100644 --- a/src/modules/audio/wrap_Source.cpp +++ b/src/modules/audio/wrap_Source.cpp @@ -273,7 +273,7 @@ int w_Source_setVolumeLimits(lua_State *L) Source *t = luax_checksource(L, 1); float vmin = (float)luaL_checknumber(L, 2); float vmax = (float)luaL_checknumber(L, 3); - if (vmin < .0f || vmin > 1.f || vmax < .0f || vmax > 1.f) + if (vmin < .0f || vmin > 1.f || vmax < .0f) return luaL_error(L, "Invalid volume limits: [%f:%f]. Must be in [0:1]", vmin, vmax); t->setMinVolume(vmin); t->setMaxVolume(vmax); diff --git a/testing/tests/audio.lua b/testing/tests/audio.lua index 7554eed12..ab3dfa611 100644 --- a/testing/tests/audio.lua +++ b/testing/tests/audio.lua @@ -87,10 +87,10 @@ love.test.audio.Source = function(test) test:assertFalse(stereo:isPlaying(), 'check stopped playing') -- check volume limits - stereo:setVolumeLimits(0.1, 0.5) + stereo:setVolumeLimits(0.1, 5.5) local min, max = stereo:getVolumeLimits() test:assertRange(min, 0.1, 0.2, 'check min limit') - test:assertRange(max, 0.5, 0.6, 'check max limit') + test:assertRange(max, 5.5, 5.6, 'check max limit') -- check setting volume stereo:setVolume(1) From e8db6f1c4c276c43de7cbc157e2ac54d44bad0a2 Mon Sep 17 00:00:00 2001 From: TimeyDingo Date: Wed, 5 Aug 2026 12:46:11 -0400 Subject: [PATCH 2/2] unclamed gain rev2 --- src/modules/audio/null/Source.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/modules/audio/null/Source.cpp b/src/modules/audio/null/Source.cpp index a689093f4..5ad03cf57 100644 --- a/src/modules/audio/null/Source.cpp +++ b/src/modules/audio/null/Source.cpp @@ -176,6 +176,9 @@ float Source::getMinVolume() const void Source::setMaxVolume(float volume) { + #ifndef AL_SOFT_gain_clamp_ex + volume = std::min(volume, 1.0f); + #endif this->maxVolume = volume; }