Merged default into minor

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2014-06-05 03:02:50 -03:00
68 changed files with 1439 additions and 524 deletions
+1
View File
@@ -692,6 +692,7 @@ int Source::streamAtomic(ALuint buffer, love::sound::Decoder *d)
{
// Get more sound data.
int decoded = d->decode();
decoded = decoded >= 0 ? decoded : 0;
int fmt = getFormat(d->getChannels(), d->getBitDepth());
+1 -4
View File
@@ -41,10 +41,7 @@ int w_getSourceCount(lua_State *L)
int w_newSource(lua_State *L)
{
if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T))
luax_convobj(L, 1, "filesystem", "newFileData");
if (luax_istype(L, 1, FILESYSTEM_FILE_DATA_T))
if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_T))
luax_convobj(L, 1, "sound", "newDecoder");
Source::Type stype = Source::TYPE_STREAM;
+21 -17
View File
@@ -36,7 +36,7 @@ int w_Source_clone(lua_State *L)
{
Source *t = luax_checksource(L, 1);
Source *clone = nullptr;
EXCEPT_GUARD(clone = t->clone();)
luax_catchexcept(L, [&](){ clone = t->clone(); });
luax_pushtype(L, "Source", AUDIO_SOURCE_T, clone);
return 1;
}
@@ -146,7 +146,7 @@ int w_Source_setPosition(lua_State *L)
v[0] = (float)luaL_checknumber(L, 2);
v[1] = (float)luaL_checknumber(L, 3);
v[2] = (float)luaL_optnumber(L, 4, 0);
EXCEPT_GUARD(t->setPosition(v);)
luax_catchexcept(L, [&](){ t->setPosition(v); });
return 0;
}
@@ -154,7 +154,7 @@ int w_Source_getPosition(lua_State *L)
{
Source *t = luax_checksource(L, 1);
float v[3];
EXCEPT_GUARD(t->getPosition(v);)
luax_catchexcept(L, [&](){ t->getPosition(v); });
lua_pushnumber(L, v[0]);
lua_pushnumber(L, v[1]);
lua_pushnumber(L, v[2]);
@@ -168,7 +168,7 @@ int w_Source_setVelocity(lua_State *L)
v[0] = (float)luaL_checknumber(L, 2);
v[1] = (float)luaL_checknumber(L, 3);
v[2] = (float)luaL_optnumber(L, 4, 0);
EXCEPT_GUARD(t->setVelocity(v);)
luax_catchexcept(L, [&](){ t->setVelocity(v); });
return 0;
}
@@ -176,7 +176,7 @@ int w_Source_getVelocity(lua_State *L)
{
Source *t = luax_checksource(L, 1);
float v[3];
EXCEPT_GUARD(t->getVelocity(v);)
luax_catchexcept(L, [&](){ t->getVelocity(v); });
lua_pushnumber(L, v[0]);
lua_pushnumber(L, v[1]);
lua_pushnumber(L, v[2]);
@@ -190,7 +190,7 @@ int w_Source_setDirection(lua_State *L)
v[0] = (float)luaL_checknumber(L, 2);
v[1] = (float)luaL_checknumber(L, 3);
v[2] = (float)luaL_optnumber(L, 4, 0);
EXCEPT_GUARD(t->setDirection(v);)
luax_catchexcept(L, [&](){ t->setDirection(v); });
return 0;
}
@@ -198,7 +198,7 @@ int w_Source_getDirection(lua_State *L)
{
Source *t = luax_checksource(L, 1);
float v[3];
EXCEPT_GUARD(t->getDirection(v);)
luax_catchexcept(L, [&](){ t->getDirection(v); });
lua_pushnumber(L, v[0]);
lua_pushnumber(L, v[1]);
lua_pushnumber(L, v[2]);
@@ -211,7 +211,7 @@ int w_Source_setCone(lua_State *L)
float innerAngle = (float) luaL_checknumber(L, 2);
float outerAngle = (float) luaL_checknumber(L, 3);
float outerVolume = (float) luaL_optnumber(L, 4, 0.0);
EXCEPT_GUARD(t->setCone(innerAngle, outerAngle, outerVolume);)
luax_catchexcept(L, [&](){ t->setCone(innerAngle, outerAngle, outerVolume); });
return 0;
}
@@ -219,7 +219,7 @@ int w_Source_getCone(lua_State *L)
{
Source *t = luax_checksource(L, 1);
float innerAngle, outerAngle, outerVolume;
EXCEPT_GUARD(t->getCone(innerAngle, outerAngle, outerVolume);)
luax_catchexcept(L, [&](){ t->getCone(innerAngle, outerAngle, outerVolume); });
lua_pushnumber(L, innerAngle);
lua_pushnumber(L, outerAngle);
lua_pushnumber(L, outerVolume);
@@ -229,14 +229,14 @@ int w_Source_getCone(lua_State *L)
int w_Source_setRelative(lua_State *L)
{
Source *t = luax_checksource(L, 1);
EXCEPT_GUARD(t->setRelative(luax_toboolean(L, 2));)
luax_catchexcept(L, [&](){ t->setRelative(luax_toboolean(L, 2)); });
return 0;
}
int w_Source_isRelative(lua_State *L)
{
Source *t = luax_checksource(L, 1);
EXCEPT_GUARD(luax_pushboolean(L, t->isRelative());)
luax_catchexcept(L, [&](){ luax_pushboolean(L, t->isRelative()); });
return 1;
}
@@ -302,16 +302,20 @@ int w_Source_setAttenuationDistances(lua_State *L)
float dmax = (float)luaL_checknumber(L, 3);
if (dref < .0f || dmax < .0f)
return luaL_error(L, "Invalid distances: %f, %f. Must be > 0", dref, dmax);
EXCEPT_GUARD(t->setReferenceDistance(dref);)
EXCEPT_GUARD(t->setMaxDistance(dmax);)
luax_catchexcept(L, [&]() {
t->setReferenceDistance(dref);
t->setMaxDistance(dmax);
});
return 0;
}
int w_Source_getAttenuationDistances(lua_State *L)
{
Source *t = luax_checksource(L, 1);
EXCEPT_GUARD(lua_pushnumber(L, t->getReferenceDistance());)
EXCEPT_GUARD(lua_pushnumber(L, t->getMaxDistance());)
luax_catchexcept(L, [&]() {
lua_pushnumber(L, t->getReferenceDistance());
lua_pushnumber(L, t->getMaxDistance());
});
return 2;
}
@@ -321,14 +325,14 @@ int w_Source_setRolloff(lua_State *L)
float rolloff = (float)luaL_checknumber(L, 2);
if (rolloff < .0f)
return luaL_error(L, "Invalid rolloff: %f. Must be > 0.", rolloff);
EXCEPT_GUARD(t->setRolloffFactor(rolloff);)
luax_catchexcept(L, [&](){ t->setRolloffFactor(rolloff); });
return 0;
}
int w_Source_getRolloff(lua_State *L)
{
Source *t = luax_checksource(L, 1);
EXCEPT_GUARD(lua_pushnumber(L, t->getRolloffFactor());)
luax_catchexcept(L, [&](){ lua_pushnumber(L, t->getRolloffFactor()); });
return 1;
}