[warps] More prep work, add lua binding.

This commit is contained in:
Jason Felds
2011-03-24 20:21:43 -04:00
parent 35a880f2ee
commit e592be406b
+27
View File
@@ -683,6 +683,14 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd )
stop.m_iStartRow += iRowsToAdd;
}
for( unsigned i = 0; i < m_WarpSegments.size(); i++ )
{
WarpSegment &warp = m_WarpSegments[i];
if (warp.m_iStartRow < iStartRow )
continue;
warp.m_iStartRow += iRowsToAdd;
}
for( unsigned i = 0; i < m_vTimeSignatureSegments.size(); i++ )
{
TimeSignatureSegment &time = m_vTimeSignatureSegments[i];
@@ -764,6 +772,23 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete )
stop.m_iStartRow -= iRowsToDelete;
}
for( unsigned i = 0; i < m_WarpSegments.size(); i++ )
{
WarpSegment &warp = m_WarpSegments[i];
if( warp.m_iStartRow < iStartRow )
continue;
if( warp.m_iStartRow < iStartRow+iRowsToDelete )
{
m_WarpSegments.erase( m_WarpSegments.begin()+i, m_WarpSegments.begin()+i+1 );
--i;
continue;
}
warp.m_iStartRow -= iRowsToDelete;
}
for( unsigned i = 0; i < m_vTimeSignatureSegments.size(); i++ )
{
TimeSignatureSegment &time = m_vTimeSignatureSegments[i];
@@ -891,6 +916,7 @@ class LunaTimingData: public Luna<TimingData>
public:
static int HasStops( T* p, lua_State *L ) { lua_pushboolean(L, p->HasStops()); return 1; }
static int HasBPMChanges( T* p, lua_State *L ) { lua_pushboolean(L, p->HasBpmChanges()); return 1; }
static int HasWarps( T* p, lua_State *L ) { lua_pushboolean(L, p->HasWarps()); return 1; }
static int GetStops( T* p, lua_State *L )
{
vector<RString> vStops;
@@ -965,6 +991,7 @@ public:
{
ADD_METHOD( HasStops );
ADD_METHOD( HasBPMChanges );
ADD_METHOD( HasWarps );
ADD_METHOD( GetStops );
ADD_METHOD( GetDelays );
ADD_METHOD( GetBPMs );