mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
unclamped gain #2336
This commit is contained in:
@@ -273,7 +273,7 @@ int w_Source_setVolumeLimits(lua_State *L)
|
|||||||
Source *t = luax_checksource(L, 1);
|
Source *t = luax_checksource(L, 1);
|
||||||
float vmin = (float)luaL_checknumber(L, 2);
|
float vmin = (float)luaL_checknumber(L, 2);
|
||||||
float vmax = (float)luaL_checknumber(L, 3);
|
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);
|
return luaL_error(L, "Invalid volume limits: [%f:%f]. Must be in [0:1]", vmin, vmax);
|
||||||
t->setMinVolume(vmin);
|
t->setMinVolume(vmin);
|
||||||
t->setMaxVolume(vmax);
|
t->setMaxVolume(vmax);
|
||||||
|
|||||||
@@ -87,10 +87,10 @@ love.test.audio.Source = function(test)
|
|||||||
test:assertFalse(stereo:isPlaying(), 'check stopped playing')
|
test:assertFalse(stereo:isPlaying(), 'check stopped playing')
|
||||||
|
|
||||||
-- check volume limits
|
-- check volume limits
|
||||||
stereo:setVolumeLimits(0.1, 0.5)
|
stereo:setVolumeLimits(0.1, 5.5)
|
||||||
local min, max = stereo:getVolumeLimits()
|
local min, max = stereo:getVolumeLimits()
|
||||||
test:assertRange(min, 0.1, 0.2, 'check min limit')
|
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
|
-- check setting volume
|
||||||
stereo:setVolume(1)
|
stereo:setVolume(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user