Merge pull request #46 from kyzentun/PlayMusicPart_loopable

Made SOUND:PlayMusicPart pass on the loop and applyRate args.
This commit is contained in:
Jason Felds
2014-02-14 20:56:27 -05:00
3 changed files with 23 additions and 9 deletions
+6 -4
View File
@@ -2035,10 +2035,12 @@ save yourself some time, copy this for undocumented things:
<Function name='PlayAnnouncer' return='void' arguments='string sPath'>
Plays a sound from the current announcer.
</Function>
<Function name='PlayMusicPart' return='void' arguments='string musicPath, float musicStart, float musicLength, float fadeIn, float fadeOut'>
Play the sound at <code>musicPath</code> starting from <code>musicStart</code> for
<code>musicLength</code> seconds one time. Both <code>fadeIn</code> and
<code>fadeOut</code> can be customized as required.
<Function name='PlayMusicPart' return='void' arguments='string musicPath, float musicStart, float musicLength, float fadeIn, float fadeOut, bool loop, bool applyRate'>
Play the sound at <code>musicPath</code> starting from <code>musicStart</code> for
<code>musicLength</code> seconds one time. Both <code>fadeIn</code> and
<code>fadeOut</code> can be customized as required. <code>loop</code>
tells the sound manager to loop the music part. <code>applyRate</code>
tells the sound manager to apply the current music rate.
</Function>
<Function name='PlayOnce' return='void' arguments='string sPath'>
Play the sound at <code>sPath</code> one time.
+15 -4
View File
@@ -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;
}
+2 -1
View File
@@ -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;