Skip to content
Snippets Groups Projects
Commit 0c4cad40 authored by dg's avatar dg
Browse files

no sound means no sound

git-svn-id: http://svn.net-core.org/repos/t-engine4@528 51575b47-30f0-44d4-a5cc-537603b46e54
parent da71e5d9
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,7 @@
static int music_new(lua_State *L)
{
if (no_sound) return 0;
const char *name = luaL_checkstring(L, 1);
Mix_Music **m = (Mix_Music**)lua_newuserdata(L, sizeof(Mix_Music*));
......@@ -67,6 +68,7 @@ static int music_play(lua_State *L)
static int music_stop(lua_State *L)
{
if (no_sound) return 0;
int fadeout = lua_isnumber(L, 1) ? lua_tonumber(L, 1) : 0;
Mix_FadeOutMusic(fadeout);
return 0;
......@@ -74,6 +76,7 @@ static int music_stop(lua_State *L)
static int music_volume(lua_State *L)
{
if (no_sound) return 0;
int vol = lua_isnumber(L, 1) ? lua_tonumber(L, 1) : 100;
Mix_VolumeMusic(SDL_MIX_MAXVOLUME * vol / 100);
......@@ -82,6 +85,7 @@ static int music_volume(lua_State *L)
static int sound_new(lua_State *L)
{
if (no_sound) return 0;
const char *name = luaL_checkstring(L, 1);
Mix_Chunk **m = (Mix_Chunk**)lua_newuserdata(L, sizeof(Mix_Chunk*));
......@@ -132,6 +136,7 @@ static int sound_volume(lua_State *L)
static int channel_fadeout(lua_State *L)
{
if (no_sound) return 0;
int chan = luaL_checknumber(L, 1);
int ms = luaL_checknumber(L, 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment