Skip to content

Commit

Permalink
Fix ambient music looping
Browse files Browse the repository at this point in the history
  • Loading branch information
WKFO authored and Web-eWorks committed Dec 11, 2020
1 parent 5b1e62e commit 0b8bcd3
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/lua/LuaMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int l_music_get_song(lua_State *l)
/*
* Method: Play
*
* Starts playing a song instantly, on repeat by default.
* Starts playing a song instantly.
*
* Example:
*
Expand All @@ -66,7 +66,7 @@ static int l_music_get_song(lua_State *l)
* Parameters:
*
* name - song file name, without data/music/ or file extension
* repeat - true or false, default true
* repeat - true or false, default false
*
* Availability:
*
Expand All @@ -79,9 +79,7 @@ static int l_music_get_song(lua_State *l)
static int l_music_play(lua_State *l)
{
const std::string song(luaL_checkstring(l, 1));
bool repeat = true;
if (lua_isboolean(l, 2))
repeat = lua_toboolean(l, 2) != 0;
bool repeat = LuaPull<bool>(l, 2, false);
Pi::GetMusicPlayer().Play(song, repeat);
return 0;
}
Expand Down Expand Up @@ -122,7 +120,7 @@ static int l_music_stop(lua_State *l)
*
* name - song file name, without data/music/ or file extension
* fade factor - 0.1 = slow fade, 1.0 = instant. The fade factor of our sound system does not represent any natural unit. Sorry.
* repeat - true or false, default true
* repeat - true or false, default false
*
* Availability:
*
Expand All @@ -136,9 +134,7 @@ static int l_music_fade_in(lua_State *l)
{
const std::string song(luaL_checkstring(l, 1));
const float fadedelta = luaL_checknumber(l, 2);
bool repeat = true;
if (lua_isboolean(l, 3))
repeat = lua_toboolean(l, 3) != 0;
bool repeat = LuaPull<bool>(l, 3, false);
Pi::GetMusicPlayer().Play(song, repeat, fadedelta);
return 0;
}
Expand Down

0 comments on commit 0b8bcd3

Please sign in to comment.