diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index d40e06f3b2..ba9d6baa90 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -2035,10 +2035,12 @@ 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. + + 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. Play the sound at sPath one time. diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index e7256efed2..db721d5a99 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -684,7 +684,8 @@ void GameSoundManager::PlayMusic( float fLengthSeconds, float fFadeInLengthSeconds, float fFadeOutLengthSeconds, - bool bAlignBeat + bool bAlignBeat, + bool bApplyMusicRate ) { PlayMusicParams params; @@ -696,7 +697,7 @@ void GameSoundManager::PlayMusic( params.fFadeInLengthSeconds = fFadeInLengthSeconds; params.fFadeOutLengthSeconds = fFadeOutLengthSeconds; params.bAlignBeat = bAlignBeat; - params.bApplyMusicRate = false; + params.bApplyMusicRate = bApplyMusicRate; PlayMusic( params ); } @@ -831,16 +832,26 @@ public: float musicLength = FArg(3); float fadeIn = 0; float fadeOut = 0; + bool loop= false; + bool applyRate= false; if (lua_gettop(L) >= 4 && !lua_isnil(L,4)) { fadeIn = FArg(4); if (lua_gettop(L) >= 5 && !lua_isnil(L,5)) { fadeOut = FArg(5); + if (lua_gettop(L) >= 6 && !lua_isnil(L,6)) + { + loop = BArg(6); + if (lua_gettop(L) >= 7 && !lua_isnil(L,7)) + { + applyRate = BArg(7); + } + } } } - p->PlayMusic(musicPath, NULL, false, musicStart, musicLength, - fadeIn, fadeOut); + p->PlayMusic(musicPath, NULL, loop, musicStart, musicLength, + fadeIn, fadeOut, applyRate); return 0; } diff --git a/src/GameSoundManager.h b/src/GameSoundManager.h index 1187924a37..addd49cea1 100644 --- a/src/GameSoundManager.h +++ b/src/GameSoundManager.h @@ -50,7 +50,8 @@ public: float length_sec = -1, float fFadeInLengthSeconds = 0, float fade_len = 0, - bool align_beat = true ); + bool align_beat = true, + bool bApplyMusicRate = false ); void StopMusic() { PlayMusic(""); } void DimMusic( float fVolume, float fDurationSeconds ); RString GetMusicPath() const;