Ejemplo n.º 1
0
int w_SoundData_getSample(lua_State *L)
{
	SoundData *sd = luax_checksounddata(L, 1);
	int i = (int)lua_tointeger(L, 2);
	lua_pushnumber(L, sd->getSample(i));
	return 1;
}
Ejemplo n.º 2
0
int w_SoundData_setSample(lua_State *L)
{
	SoundData *sd = luax_checksounddata(L, 1);
	int i = (int) luaL_checkinteger(L, 2);
	float sample = (float) luaL_checknumber(L, 3);

	EXCEPT_GUARD(sd->setSample(i, sample);)
	return 0;
Ejemplo n.º 3
0
int w_SoundData_setSample(lua_State *L)
{
	SoundData *sd = luax_checksounddata(L, 1);
	int i = (int)lua_tointeger(L, 2);
	float sample = (float)lua_tonumber(L, 3);
	sd->setSample(i, sample);
	return 0;
}
Ejemplo n.º 4
0
int w_SoundData_clone(lua_State *L)
{
	SoundData *t = luax_checksounddata(L, 1), *c = nullptr;
	luax_catchexcept(L, [&](){ c = t->clone(); });
	luax_pushtype(L, c);
	c->release();
	return 1;
}
Ejemplo n.º 5
0
int w_SoundData_getSample(lua_State *L)
{
	SoundData *sd = luax_checksounddata(L, 1);
	int i = (int) luaL_checkinteger(L, 2);

	if (lua_gettop(L) > 2)
	{
		int channel = luaL_checkinteger(L, 3);
		luax_catchexcept(L, [&](){ lua_pushnumber(L, sd->getSample(i, channel)); });
	}
	else
		luax_catchexcept(L, [&](){ lua_pushnumber(L, sd->getSample(i)); });
	return 1;
}
Ejemplo n.º 6
0
int w_SoundData_setSample(lua_State *L)
{
	SoundData *sd = luax_checksounddata(L, 1);
	int i = (int) luaL_checkinteger(L, 2);

	if (lua_gettop(L) > 3)
	{
		int channel = luaL_checkinteger(L, 3);
		float sample = (float) luaL_checknumber(L, 4);
		luax_catchexcept(L, [&](){ sd->setSample(i, channel, sample); });
	}
	else
	{
		float sample = (float) luaL_checknumber(L, 3);
		luax_catchexcept(L, [&](){ sd->setSample(i, sample); });
	}

	return 0;
}
Ejemplo n.º 7
0
int w_SoundData_getDuration(lua_State *L)
{
	SoundData *t = luax_checksounddata(L, 1);
	lua_pushnumber(L, t->getDuration());
	return 1;
}
Ejemplo n.º 8
0
int w_SoundData_getSampleCount(lua_State *L)
{
	SoundData *t = luax_checksounddata(L, 1);
	lua_pushinteger(L, t->getSampleCount());
	return 1;
}
Ejemplo n.º 9
0
int w_SoundData_getChannels(lua_State *L)
{
	SoundData *t = luax_checksounddata(L, 1);
	lua_pushinteger(L, t->getChannels());
	return 1;
}
Ejemplo n.º 10
0
int w_SoundData_getBitDepth(lua_State *L)
{
	SoundData *t = luax_checksounddata(L, 1);
	lua_pushinteger(L, t->getBitDepth());
	return 1;
}