[splittiming] Warps and Fakes are relative timed.
theDtTvB, time to scrutinize my work. ;)
This commit is contained in:
+13
-17
@@ -176,7 +176,7 @@ void TimingData::SetWarpAtRow( int iRow, float fNew )
|
|||||||
for( i=0; i<m_WarpSegments.size(); i++ )
|
for( i=0; i<m_WarpSegments.size(); i++ )
|
||||||
if( m_WarpSegments[i].m_iStartRow == iRow )
|
if( m_WarpSegments[i].m_iStartRow == iRow )
|
||||||
break;
|
break;
|
||||||
bool valid = iRow > 0 && NoteRowToBeat(iRow) < fNew;
|
bool valid = iRow > 0 && fNew > 0;
|
||||||
if( i == m_WarpSegments.size() )
|
if( i == m_WarpSegments.size() )
|
||||||
{
|
{
|
||||||
if( valid )
|
if( valid )
|
||||||
@@ -513,7 +513,7 @@ bool TimingData::IsWarpAtRow( int iNoteRow ) const
|
|||||||
|
|
||||||
int i = GetWarpSegmentIndexAtRow( iNoteRow );
|
int i = GetWarpSegmentIndexAtRow( iNoteRow );
|
||||||
const WarpSegment& s = m_WarpSegments[i];
|
const WarpSegment& s = m_WarpSegments[i];
|
||||||
if( s.m_iStartRow <= iNoteRow && iNoteRow < BeatToNoteRow(s.m_fEndBeat) )
|
if( s.m_iStartRow <= iNoteRow && iNoteRow < (s.m_iStartRow + BeatToNoteRow(s.m_fEndBeat) ) )
|
||||||
{
|
{
|
||||||
if( m_StopSegments.empty() )
|
if( m_StopSegments.empty() )
|
||||||
{
|
{
|
||||||
@@ -535,7 +535,7 @@ bool TimingData::IsFakeAtRow( int iNoteRow ) const
|
|||||||
|
|
||||||
int i = GetFakeSegmentIndexAtRow( iNoteRow );
|
int i = GetFakeSegmentIndexAtRow( iNoteRow );
|
||||||
const FakeSegment& s = m_FakeSegments[i];
|
const FakeSegment& s = m_FakeSegments[i];
|
||||||
if( s.m_iStartRow <= iNoteRow && iNoteRow < BeatToNoteRow(s.m_fEndBeat) )
|
if( s.m_iStartRow <= iNoteRow && iNoteRow < ( s.m_iStartRow + BeatToNoteRow(s.m_fEndBeat) ) )
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -829,8 +829,10 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FOUND_WARP:
|
case FOUND_WARP:
|
||||||
|
{
|
||||||
bIsWarping = true;
|
bIsWarping = true;
|
||||||
if( itWS->m_fEndBeat > fWarpDestination )
|
float fWarpSum = itWS->m_fEndBeat + NoteRowToBeat( itWS->m_iStartRow );
|
||||||
|
if( fWarpSum > fWarpDestination )
|
||||||
{
|
{
|
||||||
fWarpDestination = itWS->m_fEndBeat;
|
fWarpDestination = itWS->m_fEndBeat;
|
||||||
}
|
}
|
||||||
@@ -839,6 +841,7 @@ void TimingData::GetBeatAndBPSFromElapsedTimeNoOffset( float fElapsedTime, float
|
|||||||
itWS ++;
|
itWS ++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
iLastRow = iEventRow;
|
iLastRow = iEventRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,14 +924,17 @@ float TimingData::GetElapsedTimeFromBeatNoOffset( float fBeat ) const
|
|||||||
case FOUND_MARKER:
|
case FOUND_MARKER:
|
||||||
return fLastTime;
|
return fLastTime;
|
||||||
case FOUND_WARP:
|
case FOUND_WARP:
|
||||||
|
{
|
||||||
bIsWarping = true;
|
bIsWarping = true;
|
||||||
if( itWS->m_fEndBeat > fWarpDestination )
|
float fWarpSum = itWS->m_fEndBeat + NoteRowToBeat( itWS->m_iStartRow );
|
||||||
|
if( fWarpSum > fWarpDestination )
|
||||||
{
|
{
|
||||||
fWarpDestination = itWS->m_fEndBeat;
|
fWarpDestination = itWS->m_fEndBeat;
|
||||||
}
|
}
|
||||||
itWS ++;
|
itWS ++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
iLastRow = iEventRow;
|
iLastRow = iEventRow;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -967,7 +973,7 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool
|
|||||||
for( unsigned i = 0; i < m_WarpSegments.size(); i++ )
|
for( unsigned i = 0; i < m_WarpSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
const int iSegStartRow = m_WarpSegments[i].m_iStartRow;
|
const int iSegStartRow = m_WarpSegments[i].m_iStartRow;
|
||||||
const int iSegEndRow = BeatToNoteRow( m_WarpSegments[i].m_fEndBeat );
|
const int iSegEndRow = iSegStartRow + BeatToNoteRow( m_WarpSegments[i].m_fEndBeat );
|
||||||
if( iSegEndRow >= iStartIndex )
|
if( iSegEndRow >= iStartIndex )
|
||||||
{
|
{
|
||||||
if( iSegEndRow > iEndIndex )
|
if( iSegEndRow > iEndIndex )
|
||||||
@@ -1030,7 +1036,7 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool
|
|||||||
for( unsigned i = 0; i < m_FakeSegments.size(); i++ )
|
for( unsigned i = 0; i < m_FakeSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
const int iSegStartRow = m_FakeSegments[i].m_iStartRow;
|
const int iSegStartRow = m_FakeSegments[i].m_iStartRow;
|
||||||
const int iSegEndRow = BeatToNoteRow( m_FakeSegments[i].m_fEndBeat );
|
const int iSegEndRow = iSegStartRow + BeatToNoteRow( m_FakeSegments[i].m_fEndBeat );
|
||||||
if( iSegEndRow >= iStartIndex )
|
if( iSegEndRow >= iStartIndex )
|
||||||
{
|
{
|
||||||
if( iSegEndRow > iEndIndex )
|
if( iSegEndRow > iEndIndex )
|
||||||
@@ -1093,8 +1099,6 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd )
|
|||||||
for( unsigned i = 0; i < m_WarpSegments.size(); i++ )
|
for( unsigned i = 0; i < m_WarpSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
WarpSegment &warp = m_WarpSegments[i];
|
WarpSegment &warp = m_WarpSegments[i];
|
||||||
if( BeatToNoteRow(warp.m_fEndBeat) >= iStartRow )
|
|
||||||
warp.m_fEndBeat += NoteRowToBeat(iRowsToAdd);
|
|
||||||
if( warp.m_iStartRow < iStartRow )
|
if( warp.m_iStartRow < iStartRow )
|
||||||
continue;
|
continue;
|
||||||
warp.m_iStartRow += iRowsToAdd;
|
warp.m_iStartRow += iRowsToAdd;
|
||||||
@@ -1142,8 +1146,6 @@ void TimingData::InsertRows( int iStartRow, int iRowsToAdd )
|
|||||||
for( unsigned i = 0; i < m_FakeSegments.size(); i++ )
|
for( unsigned i = 0; i < m_FakeSegments.size(); i++ )
|
||||||
{
|
{
|
||||||
FakeSegment &fake = m_FakeSegments[i];
|
FakeSegment &fake = m_FakeSegments[i];
|
||||||
if( BeatToNoteRow(fake.m_fEndBeat) >= iStartRow )
|
|
||||||
fake.m_fEndBeat += NoteRowToBeat(iRowsToAdd);
|
|
||||||
if( fake.m_iStartRow < iStartRow )
|
if( fake.m_iStartRow < iStartRow )
|
||||||
continue;
|
continue;
|
||||||
fake.m_iStartRow += iRowsToAdd;
|
fake.m_iStartRow += iRowsToAdd;
|
||||||
@@ -1210,9 +1212,6 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete )
|
|||||||
{
|
{
|
||||||
WarpSegment &warp = m_WarpSegments[i];
|
WarpSegment &warp = m_WarpSegments[i];
|
||||||
|
|
||||||
if( BeatToNoteRow(warp.m_fEndBeat) >= iStartRow )
|
|
||||||
warp.m_fEndBeat = max( NoteRowToBeat(iStartRow), warp.m_fEndBeat - NoteRowToBeat(iRowsToDelete) );
|
|
||||||
|
|
||||||
if( warp.m_iStartRow < iStartRow )
|
if( warp.m_iStartRow < iStartRow )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1326,9 +1325,6 @@ void TimingData::DeleteRows( int iStartRow, int iRowsToDelete )
|
|||||||
{
|
{
|
||||||
FakeSegment &fake = m_FakeSegments[i];
|
FakeSegment &fake = m_FakeSegments[i];
|
||||||
|
|
||||||
if( BeatToNoteRow(fake.m_fEndBeat) >= iStartRow )
|
|
||||||
fake.m_fEndBeat = max( NoteRowToBeat(iStartRow), fake.m_fEndBeat - NoteRowToBeat(iRowsToDelete) );
|
|
||||||
|
|
||||||
if( fake.m_iStartRow < iStartRow )
|
if( fake.m_iStartRow < iStartRow )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|||||||
+12
-12
@@ -313,8 +313,8 @@ struct TimeSignatureSegment
|
|||||||
*
|
*
|
||||||
* A warp segment is used to replicate the effects of Negative BPMs without
|
* A warp segment is used to replicate the effects of Negative BPMs without
|
||||||
* abusing negative BPMs. Negative BPMs should be converted to warp segments.
|
* abusing negative BPMs. Negative BPMs should be converted to warp segments.
|
||||||
* WarpAt=WarpTo is the format, where both are in beats. (Technically they're
|
* WarpAt=WarpToRelative is the format, where both are in beats.
|
||||||
* both rows though.) */
|
* (Technically they're both rows though.) */
|
||||||
struct WarpSegment
|
struct WarpSegment
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -326,21 +326,21 @@ struct WarpSegment
|
|||||||
/**
|
/**
|
||||||
* @brief Create a Warp Segment with the specified starting row and row to warp to.
|
* @brief Create a Warp Segment with the specified starting row and row to warp to.
|
||||||
* @param s the starting row of this segment.
|
* @param s the starting row of this segment.
|
||||||
* @param r the row to warp to.
|
* @param r the number of rows to jump ahead.
|
||||||
*/
|
*/
|
||||||
WarpSegment( int s, int r ): m_iStartRow(max(0, (s < r ? s : r))),
|
WarpSegment( int s, int r ): m_iStartRow(max(0, (s < r ? s : r))),
|
||||||
m_fEndBeat(max(0, NoteRowToBeat((r > s ? r : s)))) {}
|
m_fEndBeat(max(0, NoteRowToBeat((r > s ? r : s)))) {}
|
||||||
/**
|
/**
|
||||||
* @brief Creates a Warp Segment with the specified starting row and beat to warp to.
|
* @brief Creates a Warp Segment with the specified starting row and beat to warp to.
|
||||||
* @param s the starting row of this segment.
|
* @param s the starting row of this segment.
|
||||||
* @param b the beat to warp to.
|
* @param b the number of beats to jump ahead.
|
||||||
*/
|
*/
|
||||||
WarpSegment( int s, float b ): m_iStartRow(max(0, s)),
|
WarpSegment( int s, float b ): m_iStartRow(max(0, s)),
|
||||||
m_fEndBeat(max(0, b)) {}
|
m_fEndBeat(max(0, b)) {}
|
||||||
/**
|
/**
|
||||||
* @brief Create a Warp Segment with the specified starting beat and row to warp to.
|
* @brief Create a Warp Segment with the specified starting beat and row to warp to.
|
||||||
* @param s the starting beat in this segment.
|
* @param s the starting beat in this segment.
|
||||||
* @param r the row to warp to.
|
* @param r the number of rows to jump ahead.
|
||||||
*/
|
*/
|
||||||
WarpSegment( float s, int r ):
|
WarpSegment( float s, int r ):
|
||||||
m_iStartRow(max(0, BeatToNoteRow(s))),
|
m_iStartRow(max(0, BeatToNoteRow(s))),
|
||||||
@@ -348,7 +348,7 @@ struct WarpSegment
|
|||||||
/**
|
/**
|
||||||
* @brief Creates a Warp Segment with the specified starting beat and beat to warp to.
|
* @brief Creates a Warp Segment with the specified starting beat and beat to warp to.
|
||||||
* @param s the starting beat of this segment.
|
* @param s the starting beat of this segment.
|
||||||
* @param b the beat to warp to.
|
* @param b the number of beats to jump ahead.
|
||||||
*/
|
*/
|
||||||
WarpSegment( float s, float b ):
|
WarpSegment( float s, float b ):
|
||||||
m_iStartRow(max(0, BeatToNoteRow((s < b ? s : b)))),
|
m_iStartRow(max(0, BeatToNoteRow((s < b ? s : b)))),
|
||||||
@@ -358,7 +358,7 @@ struct WarpSegment
|
|||||||
*/
|
*/
|
||||||
int m_iStartRow;
|
int m_iStartRow;
|
||||||
/**
|
/**
|
||||||
* @brief The beat to warp to.
|
* @brief The number of beats to warp ahead by.
|
||||||
*/
|
*/
|
||||||
float m_fEndBeat;
|
float m_fEndBeat;
|
||||||
/**
|
/**
|
||||||
@@ -799,21 +799,21 @@ struct FakeSegment
|
|||||||
/**
|
/**
|
||||||
* @brief Create a Fake Segment with the specified values.
|
* @brief Create a Fake Segment with the specified values.
|
||||||
* @param s the starting row of this segment.
|
* @param s the starting row of this segment.
|
||||||
* @param r the row to be real again.
|
* @param r the number of rows this segment lasts.
|
||||||
*/
|
*/
|
||||||
FakeSegment( int s, int r ): m_iStartRow(max(0, (s < r ? s : r))),
|
FakeSegment( int s, int r ): m_iStartRow(max(0, (s < r ? s : r))),
|
||||||
m_fEndBeat(max(0, NoteRowToBeat((r > s ? r : s)))) {}
|
m_fEndBeat(max(0, NoteRowToBeat((r > s ? r : s)))) {}
|
||||||
/**
|
/**
|
||||||
* @brief Creates a Fake Segment with the specified values.
|
* @brief Creates a Fake Segment with the specified values.
|
||||||
* @param s the starting row of this segment.
|
* @param s the starting row of this segment.
|
||||||
* @param b the beat to be real again.
|
* @param b the number of beats this segment lasts.
|
||||||
*/
|
*/
|
||||||
FakeSegment( int s, float b ): m_iStartRow(max(0, s)),
|
FakeSegment( int s, float b ): m_iStartRow(max(0, s)),
|
||||||
m_fEndBeat(max(0, b)) {}
|
m_fEndBeat(max(0, b)) {}
|
||||||
/**
|
/**
|
||||||
* @brief Create a Fake Segment with the specified values.
|
* @brief Create a Fake Segment with the specified values.
|
||||||
* @param s the starting beat in this segment.
|
* @param s the starting beat in this segment.
|
||||||
* @param r the row to be real again.
|
* @param r the number of rows this segment lasts.
|
||||||
*/
|
*/
|
||||||
FakeSegment( float s, int r ):
|
FakeSegment( float s, int r ):
|
||||||
m_iStartRow(max(0, BeatToNoteRow(s))),
|
m_iStartRow(max(0, BeatToNoteRow(s))),
|
||||||
@@ -821,7 +821,7 @@ struct FakeSegment
|
|||||||
/**
|
/**
|
||||||
* @brief Creates a Fake Segment with the specified values.
|
* @brief Creates a Fake Segment with the specified values.
|
||||||
* @param s the starting beat of this segment.
|
* @param s the starting beat of this segment.
|
||||||
* @param b the beat to be real again.
|
* @param b the number of beats this segment lasts.
|
||||||
*/
|
*/
|
||||||
FakeSegment( float s, float b ):
|
FakeSegment( float s, float b ):
|
||||||
m_iStartRow(max(0, BeatToNoteRow((s < b ? s : b)))),
|
m_iStartRow(max(0, BeatToNoteRow((s < b ? s : b)))),
|
||||||
@@ -831,7 +831,7 @@ struct FakeSegment
|
|||||||
*/
|
*/
|
||||||
int m_iStartRow;
|
int m_iStartRow;
|
||||||
/**
|
/**
|
||||||
* @brief The beat that ends the FakeSegment.
|
* @brief The number of beats the FakeSegment is alive for.
|
||||||
*/
|
*/
|
||||||
float m_fEndBeat;
|
float m_fEndBeat;
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user