diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index 0da696f734..4bac917164 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,10 @@ ________________________________________________________________________________ StepMania 5.0 $next | 2011xxxx -------------------------------------------------------------------------------- +2011/10/08 +---------- +* [GameSoundManager] Add the PlayMusicPart lua binding. [Wolfman2000] + 2011/10/07 ---------- * [RageDisplay] Add the GetFPS, GetVPF, and GetCumFPS bindings. [Wolfman2000] diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index ce09d46c44..1f9ee43352 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -701,6 +701,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 4e868a5353..436c602a5d 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -1829,6 +1829,11 @@ Plays a sound from the current announcer. + + Play the sound at musicPath starting from musicStart for + musicLength seconds one time. Both fadeIn and + fadeOut can be customized as required. + Play the sound at sPath one time. diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index 78fca8efa6..5c7679303b 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -807,9 +807,43 @@ public: p->DimMusic( fVolume, fDurationSeconds ); return 0; } - static int PlayOnce( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnce( sPath ); return 0; } - static int PlayAnnouncer( T* p, lua_State *L ) { RString sPath = SArg(1); p->PlayOnceFromAnnouncer( sPath ); return 0; } - static int GetPlayerBalance( T* p, lua_State *L ) { PlayerNumber pn = Enum::Check(L, 1); lua_pushnumber( L, p->GetPlayerBalance(pn) ); return 1; } + static int PlayOnce( T* p, lua_State *L ) + { + RString sPath = SArg(1); + p->PlayOnce( sPath ); + return 0; + } + static int PlayAnnouncer( T* p, lua_State *L ) + { + RString sPath = SArg(1); + p->PlayOnceFromAnnouncer( sPath ); + return 0; + } + static int GetPlayerBalance( T* p, lua_State *L ) + { + PlayerNumber pn = Enum::Check(L, 1); + lua_pushnumber( L, p->GetPlayerBalance(pn) ); + return 1; + } + static int PlayMusicPart( T* p, lua_State *L ) + { + RString musicPath = SArg(1); + float musicStart = FArg(2); + float musicLength = FArg(3); + float fadeIn = 0; + float fadeOut = 0; + if (lua_gettop(L) >= 4 && !lua_isnil(L,4)) + { + fadeIn = FArg(4); + if (lua_gettop(L) >= 5 && !lua_isnil(L,5)) + { + fadeOut = FArg(5); + } + } + p->PlayMusic(musicPath, NULL, false, musicStart, musicLength, + fadeIn, fadeOut); + return 0; + } LunaGameSoundManager() { @@ -817,6 +851,7 @@ public: ADD_METHOD( PlayOnce ); ADD_METHOD( PlayAnnouncer ); ADD_METHOD( GetPlayerBalance ); + ADD_METHOD( PlayMusicPart ); } };