Merge pull request #2345 from TimeyDingo/CallieTesting

unclamped gain #2336
This commit is contained in:
Sasha Szpakowski
2026-08-05 18:03:50 -03:00
committed by GitHub
3 changed files with 6 additions and 3 deletions
+3
View File
@@ -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;
}
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -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)