diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index bc4e99d244..6009181605 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -731,6 +731,7 @@ + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 61886525d3..cad9107811 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2190,12 +2190,13 @@ save yourself some time, copy this for undocumented things: 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. loop tells the sound manager to loop the music part. applyRate - tells the sound manager to apply the current music rate. + tells the sound manager to apply the current music rate. If alignBeat + is true or nil, the length is automatically adjusted to cover an integer number of beats. Play the sound at sPath one time. @@ -2203,6 +2204,9 @@ save yourself some time, copy this for undocumented things: Stops the music. + + When music is requested to change, the new music does not start immediately due to latency and buffering. This will return true if the newest music has not yet actually begun. + diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index 18b95670cb..c9c1f33ab9 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -834,6 +834,7 @@ public: float fadeOut = 0; bool loop= false; bool applyRate= false; + bool alignBeat= true; if (lua_gettop(L) >= 4 && !lua_isnil(L,4)) { fadeIn = FArg(4); @@ -846,16 +847,21 @@ public: if (lua_gettop(L) >= 7 && !lua_isnil(L,7)) { applyRate = BArg(7); + if (lua_gettop(L) >= 8 && !lua_isnil(L,8)) + { + alignBeat = BArg(8); + } } } } } p->PlayMusic(musicPath, NULL, loop, musicStart, musicLength, - fadeIn, fadeOut, applyRate); + fadeIn, fadeOut, alignBeat, applyRate); return 0; } - static int StopMusic( T* p, lua_State *L ) { p->StopMusic(); return 0; } + static int StopMusic( T* p, lua_State *L ) { p->StopMusic(); return 0; } + static int IsTimingDelayed( T* p, lua_State *L ) { lua_pushboolean( L, g_Playing->m_bTimingDelayed ); return 1; } LunaGameSoundManager() { @@ -865,6 +871,7 @@ public: ADD_METHOD( GetPlayerBalance ); ADD_METHOD( PlayMusicPart ); ADD_METHOD( StopMusic ); + ADD_METHOD( IsTimingDelayed ); } };