Merge pull request #230 from sigatrev/GameSoundManager

add SOUND:IsTimingDelayed method and fixed SOUND:PlayMusicPart
This commit is contained in:
AJ Kelly
2014-07-19 15:35:47 -05:00
3 changed files with 16 additions and 4 deletions
+1
View File
@@ -731,6 +731,7 @@
<Function name='PlayMusicPart'/>
<Function name='PlayOnce'/>
<Function name='StopMusic'/>
<Function name='IsTimingDelayed'/>
</Class>
<Class name='GameState'>
<Function name='AddStageToPlayer'/>
+6 -2
View File
@@ -2190,12 +2190,13 @@ 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, bool loop, bool applyRate'>
<Function name='PlayMusicPart' return='void' arguments='string musicPath, float musicStart, float musicLength, float fadeIn, float fadeOut, bool loop, bool applyRate, bool alignBeat'>
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.
tells the sound manager to apply the current music rate. If <code>alignBeat</code>
is true or nil, the length is automatically adjusted to cover an integer number of beats.
</Function>
<Function name='PlayOnce' return='void' arguments='string sPath'>
Play the sound at <code>sPath</code> one time.
@@ -2203,6 +2204,9 @@ save yourself some time, copy this for undocumented things:
<Function name='StopMusic' return='void' arguments='void'>
Stops the music.
</Function>
<Function name='IsTimingDelayed' return='void' arguments='void'>
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.
</Function>
</Class>
<Class name='GameState'>
<Function name='AddStageToPlayer' return='void' arguments='PlayerNumber pn'>
+9 -2
View File
@@ -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 );
}
};