From e592be406b39d8dc5459f30784b673db15b06bba Mon Sep 17 00:00:00 2001 From: Jason Felds Date: Thu, 24 Mar 2011 20:21:43 -0400 Subject: [PATCH] [warps] More prep work, add lua binding. --- src/TimingData.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/TimingData.cpp b/src/TimingData.cpp index 9704ac00c3..7eb82e36eb 100644 --- a/src/TimingData.cpp +++ b/src/TimingData.cpp @@ -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 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 vStops; @@ -965,6 +991,7 @@ public: { ADD_METHOD( HasStops ); ADD_METHOD( HasBPMChanges ); + ADD_METHOD( HasWarps ); ADD_METHOD( GetStops ); ADD_METHOD( GetDelays ); ADD_METHOD( GetBPMs );