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)