From a67ee09abfac3d22d256a62ef0ba150cf2dbc553 Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Sun, 18 Sep 2011 14:41:28 -0400 Subject: [PATCH] Added two new Lua bindings to Song. GetSampleStart() GetSampleLength() --- Docs/Changelog_sm5.txt | 5 +++++ Docs/Luadoc/Lua.xml | 2 ++ Docs/Luadoc/LuaDocumentation.xml | 6 ++++++ src/Song.cpp | 12 ++++++++++++ 4 files changed, 25 insertions(+) diff --git a/Docs/Changelog_sm5.txt b/Docs/Changelog_sm5.txt index c037661321..2ed3ac9132 100644 --- a/Docs/Changelog_sm5.txt +++ b/Docs/Changelog_sm5.txt @@ -8,6 +8,11 @@ ________________________________________________________________________________ StepMania 5.0 $next | 2011???? -------------------------------------------------------------------------------- +2011/09/18 +---------- +* [Song] Added GetSampleStart() and GetSampleLength() + Lua bindings. [Wolfman2000] + 2011/09/16 ---------- * [UnlockManager] Added GetNumLockedSongs() Lua binding. [Wolfman2000] diff --git a/Docs/Luadoc/Lua.xml b/Docs/Luadoc/Lua.xml index 82e4d30bda..79b0ddb7f9 100644 --- a/Docs/Luadoc/Lua.xml +++ b/Docs/Luadoc/Lua.xml @@ -1279,6 +1279,8 @@ + + diff --git a/Docs/Luadoc/LuaDocumentation.xml b/Docs/Luadoc/LuaDocumentation.xml index 7fe7b921a3..cea772098f 100644 --- a/Docs/Luadoc/LuaDocumentation.xml +++ b/Docs/Luadoc/LuaDocumentation.xml @@ -3364,6 +3364,12 @@ Gets the Song's origin. + + Gets the length of a song's sample time in seconds. + + + Gets the starting position of a song sample in seconds. + Returns the song's directory. diff --git a/src/Song.cpp b/src/Song.cpp index 08182feaa6..181f552d83 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -1761,6 +1761,16 @@ public: lua_pushnumber(L, p->m_fMusicLengthSeconds); return 1; } + static int GetSampleStart( T* p, lua_State *L ) + { + lua_pushnumber(L, p->m_fMusicSampleStartSeconds); + return 1; + } + static int GetSampleLength( T* p, lua_State *L ) + { + lua_pushnumber(L, p->m_fMusicSampleLengthSeconds); + return 1; + } static int IsLong( T* p, lua_State *L ) { lua_pushboolean(L, p->IsLong()); @@ -1926,6 +1936,8 @@ public: ADD_METHOD( IsEnabled ); ADD_METHOD( GetGroupName ); ADD_METHOD( MusicLengthSeconds ); + ADD_METHOD( GetSampleStart ); + ADD_METHOD( GetSampleLength ); ADD_METHOD( IsLong ); ADD_METHOD( IsMarathon ); ADD_METHOD( HasStepsType );