Add the PlayMusicPart lua binding.

Required params are musicPath, musicStart, and musicLength.
Optional params are fadeIn and fadeOut in that order.
This commit is contained in:
Jason Felds
2011-10-08 11:41:05 -04:00
parent 6a393dc6f6
commit 9f3993b4ab
4 changed files with 48 additions and 3 deletions
+4
View File
@@ -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]
+1
View File
@@ -701,6 +701,7 @@
<Function name='DimMusic'/>
<Function name='GetPlayerBalance'/>
<Function name='PlayAnnouncer'/>
<Function name='PlayMusicPart'/>
<Function name='PlayOnce'/>
</Class>
<Class name='GameState'>
+5
View File
@@ -1829,6 +1829,11 @@
<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 = 0, float fadeOut = 0'>
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>
<Function name='PlayOnce' return='void' arguments='string sPath'>
Play the sound at <code>sPath</code> one time.
</Function>
+38 -3
View File
@@ -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<PlayerNumber>(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<PlayerNumber>(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 );
}
};