[timing] More respect of pointers.

Again going to trust virtual functions to do the right thing.
This commit is contained in:
Jason Felds
2011-07-14 23:15:48 -04:00
parent c9a6bbbafe
commit 6f5ab98dec
7 changed files with 139 additions and 146 deletions
+4 -4
View File
@@ -310,8 +310,8 @@ void SMLoader::ProcessStops( TimingData &out, const RString line, const int rows
// Process the prior stop.
if( negPause > 0 )
{
BPMSegment oldBPM = out.GetBPMSegmentAtRow(BeatToNoteRow(negBeat));
float fSecondsPerBeat = 60 / oldBPM.GetBPM();
BPMSegment * oldBPM = out.GetBPMSegmentAtRow(BeatToNoteRow(negBeat));
float fSecondsPerBeat = 60 / oldBPM->GetBPM();
float fSkipBeats = negPause / fSecondsPerBeat;
if( negBeat + fSkipBeats > fFreezeBeat )
@@ -339,8 +339,8 @@ void SMLoader::ProcessStops( TimingData &out, const RString line, const int rows
// Process the prior stop if there was one.
if( negPause > 0 )
{
BPMSegment oldBPM = out.GetBPMSegmentAtBeat(negBeat);
float fSecondsPerBeat = 60 / oldBPM.GetBPM();
BPMSegment * oldBPM = out.GetBPMSegmentAtBeat(negBeat);
float fSecondsPerBeat = 60 / oldBPM->GetBPM();
float fSkipBeats = negPause / fSecondsPerBeat;
out.AddSegment(SEGMENT_WARP, new WarpSegment(negBeat, fSkipBeats));
+2 -2
View File
@@ -2956,10 +2956,10 @@ void Player::CrossedRows( int iLastRowCrossed, const RageTimer &now )
}
else if( CHECKPOINTS_USE_TIME_SIGNATURES )
{
TimeSignatureSegment & tSignature = m_Timing->GetTimeSignatureSegmentAtRow( iLastRowCrossed );
TimeSignatureSegment * tSignature = m_Timing->GetTimeSignatureSegmentAtRow( iLastRowCrossed );
// Most songs are in 4/4 time. The frequency for checking tick counts should reflect that.
iCheckpointFrequencyRows = ROWS_PER_BEAT * tSignature.GetDen() / (tSignature.GetNum() * 4);
iCheckpointFrequencyRows = ROWS_PER_BEAT * tSignature->GetDen() / (tSignature->GetNum() * 4);
}
if( iCheckpointFrequencyRows > 0 )
+7 -7
View File
@@ -429,14 +429,14 @@ void ScoreKeeperNormal::HandleTapNoteScoreInternal( TapNoteScore tns, TapNoteSco
// update judged row totals. Respect Combo segments here.
TimingData &td = GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber]->m_Timing;
ComboSegment &cs = td.GetComboSegmentAtRow(row);
ComboSegment *cs = td.GetComboSegmentAtRow(row);
if (tns == TNS_CheckpointHit || tns >= m_MinScoreToContinueCombo)
{
m_pPlayerStageStats->m_iTapNoteScores[tns] += cs.GetCombo();
m_pPlayerStageStats->m_iTapNoteScores[tns] += cs->GetCombo();
}
else if (tns == TNS_CheckpointMiss || tns < m_MinScoreToMaintainCombo)
{
m_pPlayerStageStats->m_iTapNoteScores[tns] += cs.GetMissCombo();
m_pPlayerStageStats->m_iTapNoteScores[tns] += cs->GetMissCombo();
}
else
{
@@ -464,13 +464,13 @@ void ScoreKeeperNormal::HandleComboInternal( int iNumHitContinueCombo, int iNumH
TimingData td = GAMESTATE->m_pCurSteps[m_pPlayerState->m_PlayerNumber]->m_Timing;
if( iNumBreakCombo == 0 )
{
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow( iRow ).GetCombo() );
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow( iRow )->GetCombo() );
m_pPlayerStageStats->m_iCurCombo += iNumHitContinueCombo * multiplier;
}
else
{
m_pPlayerStageStats->m_iCurCombo = 0;
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow(iRow).GetMissCombo());
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow(iRow)->GetMissCombo());
m_pPlayerStageStats->m_iCurMissCombo += ( m_MissComboIsPerRow ? 1 : iNumBreakCombo ) * multiplier;
}
}
@@ -485,7 +485,7 @@ void ScoreKeeperNormal::HandleRowComboInternal( TapNoteScore tns, int iNumTapsIn
if ( tns >= m_MinScoreToContinueCombo )
{
m_pPlayerStageStats->m_iCurMissCombo = 0;
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow( iRow ).GetCombo() );
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow( iRow )->GetCombo() );
m_pPlayerStageStats->m_iCurCombo += iNumTapsInRow * multiplier;
}
else if ( tns < m_MinScoreToMaintainCombo )
@@ -494,7 +494,7 @@ void ScoreKeeperNormal::HandleRowComboInternal( TapNoteScore tns, int iNumTapsIn
if( tns <= m_MaxScoreToIncrementMissCombo )
{
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow(iRow).GetMissCombo());
int multiplier = ( iRow == -1 ? 1 : td.GetComboSegmentAtRow(iRow)->GetMissCombo());
m_pPlayerStageStats->m_iCurMissCombo += ( m_MissComboIsPerRow ? 1 : iNumTapsInRow ) * multiplier;
}
}
+13 -13
View File
@@ -1465,7 +1465,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
}
TimingData &sTiming = GetAppropriateTiming();
float playerBeat = GetAppropriatePosition().m_fSongBeat;
int beatsPerMeasure = sTiming.GetTimeSignatureSegmentAtBeat( playerBeat ).GetNum();
int beatsPerMeasure = sTiming.GetTimeSignatureSegmentAtBeat( playerBeat )->GetNum();
switch( EditB )
{
@@ -3648,7 +3648,7 @@ void ScreenEdit::DisplayTimingMenu()
{
float fBeat = GetBeat();
TimingData &pTime = GetAppropriateTiming();
bool bHasSpeedOnThisRow = pTime.GetSpeedSegmentAtBeat( fBeat ).GetBeat() == fBeat;
bool bHasSpeedOnThisRow = pTime.GetSpeedSegmentAtBeat( fBeat )->GetBeat() == fBeat;
g_TimingDataInformation.rows[beat_0_offset].SetOneUnthemedChoice( ssprintf("%.6f", pTime.m_fBeat0OffsetInSeconds) );
g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetBPMAtBeat( fBeat ) ) );
@@ -4647,11 +4647,11 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
break;
case time_signature:
{
TimeSignatureSegment &ts = GetAppropriateTiming().GetTimeSignatureSegmentAtBeat( GetBeat() );
TimeSignatureSegment * ts = GetAppropriateTiming().GetTimeSignatureSegmentAtBeat( GetBeat() );
ScreenTextEntry::TextEntry(
SM_BackFromTimeSignatureChange,
ENTER_TIME_SIGNATURE_VALUE,
ssprintf( "%d/%d", ts.GetNum(), ts.GetDen() ),
ssprintf( "%d/%d", ts->GetNum(), ts->GetDen() ),
8
);
break;
@@ -4666,12 +4666,12 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
break;
case combo:
{
ComboSegment &cs = GetAppropriateTiming().GetComboSegmentAtBeat(GetBeat());
ComboSegment *cs = GetAppropriateTiming().GetComboSegmentAtBeat(GetBeat());
ScreenTextEntry::TextEntry(SM_BackFromComboChange,
ENTER_COMBO_VALUE,
ssprintf( "%d/%d",
cs.GetCombo(),
cs.GetMissCombo()),
cs->GetCombo(),
cs->GetMissCombo()),
7);
break;
}
@@ -4695,7 +4695,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromSpeedPercentChange,
ENTER_SPEED_PERCENT_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() ).GetRatio() ),
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetRatio() ),
10
);
break;
@@ -4703,7 +4703,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromScrollChange,
ENTER_SCROLL_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() ).GetRatio() ),
ssprintf( "%.6f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() )->GetRatio() ),
10
);
break;
@@ -4711,7 +4711,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry(
SM_BackFromSpeedWaitChange,
ENTER_SPEED_WAIT_VALUE,
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() ).GetLength() ),
ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() )->GetLength() ),
10
);
break;
@@ -4982,8 +4982,8 @@ void ScreenEdit::CheckNumberOfNotesAndUndo()
if( EDIT_MODE.GetValue() != EditMode_Home )
return;
TimeSignatureSegment &curTime = GAMESTATE->m_pCurSong->m_SongTiming.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat );
int rowsPerMeasure = curTime.GetDen() * curTime.GetNum();
TimeSignatureSegment * curTime = GAMESTATE->m_pCurSong->m_SongTiming.GetTimeSignatureSegmentAtBeat( GAMESTATE->m_pPlayerState[PLAYER_1]->m_Position.m_fSongBeat );
int rowsPerMeasure = curTime->GetDen() * curTime->GetNum();
for( int row=0; row<=m_NoteDataEdit.GetLastRow(); row+=rowsPerMeasure )
{
@@ -5037,7 +5037,7 @@ float ScreenEdit::GetMaximumBeatForNewNote() const
* beats. */
TimingData &timing = s.m_SongTiming;
float playerBeat = GetAppropriatePosition().m_fSongBeat;
int beatsPerMeasure = timing.GetTimeSignatureSegmentAtBeat( playerBeat ).GetNum();
int beatsPerMeasure = timing.GetTimeSignatureSegmentAtBeat( playerBeat )->GetNum();
fEndBeat += beatsPerMeasure;
fEndBeat = ftruncf( fEndBeat, (float)beatsPerMeasure );
+2 -2
View File
@@ -221,8 +221,8 @@ bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input )
}
if( GAMESTATE->m_pCurSong != NULL )
{
BPMSegment& seg = GAMESTATE->m_pCurSong->m_SongTiming.GetBPMSegmentAtBeat( GAMESTATE->m_Position.m_fSongBeat );
seg.SetBPS( seg.GetBPS() + fDelta );
BPMSegment * seg = GAMESTATE->m_pCurSong->m_SongTiming.GetBPMSegmentAtBeat( GAMESTATE->m_Position.m_fSongBeat );
seg->SetBPS( seg->GetBPS() + fDelta );
}
}
break;
+87 -94
View File
@@ -160,13 +160,13 @@ void TimingData::SetTimeSignatureNumeratorAtRow( int iRow, int iNumerator )
{
this->SetTimeSignatureAtRow(iRow,
iNumerator,
GetTimeSignatureSegmentAtRow(iRow).GetDen());
GetTimeSignatureSegmentAtRow(iRow)->GetDen());
}
void TimingData::SetTimeSignatureDenominatorAtRow( int iRow, int iDenominator )
{
this->SetTimeSignatureAtRow(iRow,
GetTimeSignatureSegmentAtRow(iRow).GetNum(),
GetTimeSignatureSegmentAtRow(iRow)->GetNum(),
iDenominator);
}
@@ -258,13 +258,13 @@ void TimingData::SetHitComboAtRow(int iRow, int iCombo)
{
this->SetComboAtRow(iRow,
iCombo,
this->GetComboSegmentAtRow(iRow).GetMissCombo());
this->GetComboSegmentAtRow(iRow)->GetMissCombo());
}
void TimingData::SetMissComboAtRow(int iRow, int iMiss)
{
this->SetComboAtRow(iRow,
this->GetComboSegmentAtRow(iRow).GetCombo(),
this->GetComboSegmentAtRow(iRow)->GetCombo(),
iMiss);
}
@@ -390,23 +390,23 @@ void TimingData::SetSpeedPercentAtRow( int iRow, float fPercent )
{
SetSpeedAtRow( iRow,
fPercent,
GetSpeedSegmentAtBeat( NoteRowToBeat( iRow ) ).GetLength(),
GetSpeedSegmentAtBeat( NoteRowToBeat( iRow ) ).GetUnit());
GetSpeedSegmentAtRow( iRow )->GetLength(),
GetSpeedSegmentAtRow( iRow )->GetUnit());
}
void TimingData::SetSpeedWaitAtRow( int iRow, float fWait )
{
SetSpeedAtRow( iRow,
GetSpeedSegmentAtBeat( NoteRowToBeat( iRow ) ).GetRatio(),
GetSpeedSegmentAtRow( iRow )->GetRatio(),
fWait,
GetSpeedSegmentAtBeat( NoteRowToBeat( iRow ) ).GetUnit());
GetSpeedSegmentAtRow( iRow )->GetUnit());
}
void TimingData::SetSpeedModeAtRow( int iRow, unsigned short usMode )
{
SetSpeedAtRow( iRow,
GetSpeedSegmentAtBeat( NoteRowToBeat( iRow ) ).GetRatio(),
GetSpeedSegmentAtBeat( NoteRowToBeat( iRow ) ).GetLength(),
GetSpeedSegmentAtRow( iRow )->GetRatio(),
GetSpeedSegmentAtRow( iRow )->GetLength(),
usMode );
}
@@ -472,22 +472,22 @@ float TimingData::GetWarpAtRow( int iWarpRow ) const
float TimingData::GetSpeedPercentAtRow( int iRow )
{
return GetSpeedSegmentAtRow( iRow ).GetRatio();
return GetSpeedSegmentAtRow( iRow )->GetRatio();
}
float TimingData::GetSpeedWaitAtRow( int iRow )
{
return GetSpeedSegmentAtRow( iRow ).GetLength();
return GetSpeedSegmentAtRow( iRow )->GetLength();
}
unsigned short TimingData::GetSpeedModeAtRow( int iRow )
{
return GetSpeedSegmentAtRow( iRow ).GetUnit();
return GetSpeedSegmentAtRow( iRow )->GetUnit();
}
float TimingData::GetScrollAtRow( int iRow )
{
return GetScrollSegmentAtRow( iRow ).GetRatio();
return GetScrollSegmentAtRow( iRow )->GetRatio();
}
float TimingData::GetFakeAtRow( int iFakeRow ) const
@@ -597,114 +597,122 @@ bool TimingData::IsFakeAtRow( int iNoteRow ) const
return false;
}
BPMSegment& TimingData::GetBPMSegmentAtRow( int iNoteRow )
BPMSegment* TimingData::GetBPMSegmentAtRow( int iNoteRow )
{
vector<TimingSegment *> &bpms = this->allTimingSegments[SEGMENT_BPM];
static BPMSegment empty;
if( m_BPMSegments.empty() )
return empty;
if( bpms.empty() )
return new BPMSegment();
int i = GetSegmentIndexAtRow( SEGMENT_BPM, iNoteRow );
return m_BPMSegments[i];
return static_cast<BPMSegment *>(bpms[i]);
}
TimeSignatureSegment& TimingData::GetTimeSignatureSegmentAtRow( int iRow )
TimeSignatureSegment* TimingData::GetTimeSignatureSegmentAtRow( int iRow )
{
unsigned i;
for( i=0; i<m_vTimeSignatureSegments.size()-1; i++ )
if( m_vTimeSignatureSegments[i+1].GetRow() > iRow )
vector<TimingSegment *> &tSigs = this->allTimingSegments[SEGMENT_TIME_SIG];
for( i=0; i<tSigs.size()-1; i++ )
if( tSigs[i+1]->GetRow() > iRow )
break;
return m_vTimeSignatureSegments[i];
return static_cast<TimeSignatureSegment *>(tSigs[i]);
}
SpeedSegment& TimingData::GetSpeedSegmentAtRow( int iRow )
SpeedSegment* TimingData::GetSpeedSegmentAtRow( int iRow )
{
unsigned i;
for( i=0; i<m_SpeedSegments.size()-1; i++ )
if( m_SpeedSegments[i+1].GetRow() > iRow )
vector<TimingSegment *> &speeds = this->allTimingSegments[SEGMENT_SPEED];
for( i=0; i<speeds.size()-1; i++ )
if( speeds[i+1]->GetRow() > iRow )
break;
return m_SpeedSegments[i];
return static_cast<SpeedSegment *>(speeds[i]);
}
ScrollSegment& TimingData::GetScrollSegmentAtRow( int iRow )
ScrollSegment* TimingData::GetScrollSegmentAtRow( int iRow )
{
unsigned i;
for( i=0; i<m_ScrollSegments.size()-1; i++ )
if( m_ScrollSegments[i+1].GetRow() > iRow )
vector<TimingSegment *> &scrolls = this->allTimingSegments[SEGMENT_SCROLL];
for( i=0; i<scrolls.size()-1; i++ )
if( scrolls[i+1]->GetRow() > iRow )
break;
return m_ScrollSegments[i];
return static_cast<ScrollSegment *>(scrolls[i]);
}
int TimingData::GetTimeSignatureNumeratorAtRow( int iRow )
{
return GetTimeSignatureSegmentAtRow( iRow ).GetNum();
return GetTimeSignatureSegmentAtRow( iRow )->GetNum();
}
int TimingData::GetTimeSignatureDenominatorAtRow( int iRow )
{
return GetTimeSignatureSegmentAtRow( iRow ).GetDen();
return GetTimeSignatureSegmentAtRow( iRow )->GetDen();
}
ComboSegment& TimingData::GetComboSegmentAtRow( int iRow )
ComboSegment* TimingData::GetComboSegmentAtRow( int iRow )
{
unsigned i;
for( i=0; i<m_ComboSegments.size()-1; i++ )
if( m_ComboSegments[i+1].GetRow() > iRow )
vector<TimingSegment *> &combos = this->allTimingSegments[SEGMENT_COMBO];
for( i=0; i<combos.size()-1; i++ )
if( combos[i+1]->GetRow() > iRow )
break;
return m_ComboSegments[i];
return static_cast<ComboSegment *>(combos[i]);
}
LabelSegment& TimingData::GetLabelSegmentAtRow( int iRow )
LabelSegment* TimingData::GetLabelSegmentAtRow( int iRow )
{
unsigned i;
for( i=0; i<m_LabelSegments.size()-1; i++ )
if( m_LabelSegments[i+1].GetRow() > iRow )
vector<TimingSegment *> &labels = this->allTimingSegments[SEGMENT_LABEL];
for( i=0; i<labels.size()-1; i++ )
if( labels[i+1]->GetRow() > iRow )
break;
return m_LabelSegments[i];
return static_cast<LabelSegment *>(labels[i]);
}
StopSegment& TimingData::GetStopSegmentAtRow( int iNoteRow, bool bDelay )
StopSegment* TimingData::GetStopSegmentAtRow( int iNoteRow, bool bDelay )
{
static StopSegment empty;
if( m_StopSegments.empty() )
return empty;
vector<TimingSegment *> &stops = this->allTimingSegments[SEGMENT_STOP_DELAY];
if( stops.empty() )
return new StopSegment();
int i = GetSegmentIndexAtRow( SEGMENT_STOP_DELAY, iNoteRow, bDelay );
return m_StopSegments[i];
return static_cast<StopSegment *>(stops[i]);
}
WarpSegment& TimingData::GetWarpSegmentAtRow( int iRow )
WarpSegment* TimingData::GetWarpSegmentAtRow( int iRow )
{
static WarpSegment empty;
if( m_WarpSegments.empty() )
return empty;
vector<TimingSegment *> &warps = this->allTimingSegments[SEGMENT_WARP];
if( warps.empty() )
return new WarpSegment();
int i = GetSegmentIndexAtRow( SEGMENT_WARP, iRow );
return m_WarpSegments[i];
return static_cast<WarpSegment *>(warps[i]);
}
FakeSegment& TimingData::GetFakeSegmentAtRow( int iRow )
FakeSegment* TimingData::GetFakeSegmentAtRow( int iRow )
{
static FakeSegment empty;
if( m_FakeSegments.empty() )
return empty;
vector<TimingSegment *> &fakes = this->allTimingSegments[SEGMENT_FAKE];
if( fakes.empty() )
return new FakeSegment();
int i = GetSegmentIndexAtRow( SEGMENT_FAKE, iRow );
return m_FakeSegments[i];
return static_cast<FakeSegment *>(fakes[i]);
}
TickcountSegment& TimingData::GetTickcountSegmentAtRow( int iRow )
TickcountSegment* TimingData::GetTickcountSegmentAtRow( int iRow )
{
static TickcountSegment empty;
if( m_TickcountSegments.empty() )
return empty;
vector<TimingSegment *> &ticks = this->allTimingSegments[SEGMENT_TICKCOUNT];
if( ticks.empty() )
return new TickcountSegment();
int i = GetSegmentIndexAtRow( SEGMENT_TICKCOUNT, iRow );
return m_TickcountSegments[i];
return static_cast<TickcountSegment *>(ticks[i]);
}
int TimingData::GetTickcountAtRow( int iRow ) const
{
return m_TickcountSegments[GetSegmentIndexAtRow( SEGMENT_TICKCOUNT, iRow )].GetTicks();
const vector<TimingSegment *> &ticks = this->allTimingSegments[SEGMENT_TICKCOUNT];
const int index = GetSegmentIndexAtRow( SEGMENT_TICKCOUNT, iRow );
return static_cast<TickcountSegment *>(ticks[index])->GetTicks();
}
float TimingData::GetPreviousBPMSegmentBeatAtRow( int iRow ) const
@@ -1017,9 +1025,10 @@ float TimingData::GetNextLabelSegmentBeatAtRow( int iRow ) const
bool TimingData::DoesLabelExist( RString sLabel ) const
{
FOREACH_CONST( LabelSegment, m_LabelSegments, seg )
const vector<TimingSegment *> &labels = this->allTimingSegments[SEGMENT_LABEL];
for (unsigned i = 0; i < labels.size(); i++)
{
if( seg->GetLabel() == sLabel )
if (static_cast<LabelSegment *>(labels[i])->GetLabel() == sLabel)
return true;
}
return false;
@@ -1264,35 +1273,15 @@ void TimingData::ScaleRegion( float fScale, int iStartIndex, int iEndIndex, bool
int length = iEndIndex - iStartIndex;
int newLength = lrintf( fScale * length );
for ( unsigned i = 0; i < m_BPMSegments.size(); i++ )
m_BPMSegments[i].Scale( iStartIndex, length, newLength );
for( unsigned i = 0; i < m_StopSegments.size(); i++ )
m_StopSegments[i].Scale( iStartIndex, length, newLength );
for( unsigned i = 0; i < m_vTimeSignatureSegments.size(); i++ )
m_vTimeSignatureSegments[i].Scale( iStartIndex, length, newLength );
for( unsigned i = 0; i < m_WarpSegments.size(); i++ )
m_WarpSegments[i].Scale( iStartIndex, length, newLength );
for ( unsigned i = 0; i < m_TickcountSegments.size(); i++ )
m_TickcountSegments[i].Scale( iStartIndex, length, newLength );
for ( unsigned i = 0; i < m_ComboSegments.size(); i++ )
m_ComboSegments[i].Scale( iStartIndex, length, newLength );
for ( unsigned i = 0; i < m_LabelSegments.size(); i++ )
m_LabelSegments[i].Scale( iStartIndex, length, newLength );
for ( unsigned i = 0; i < m_SpeedSegments.size(); i++ )
m_SpeedSegments[i].Scale( iStartIndex, length, newLength );
for( unsigned i = 0; i < m_FakeSegments.size(); i++ )
m_FakeSegments[i].Scale( iStartIndex, length, newLength );
for( unsigned i = 0; i < m_ScrollSegments.size(); i++ )
m_ScrollSegments[i].Scale( iStartIndex, length, newLength );
// TODO: Confirm this works as intended.
for (unsigned i = 0; i < NUM_TimingSegmentTypes; i++)
{
vector<TimingSegment *> &segs = this->allTimingSegments[i];
for (unsigned j = 0; j < segs.size(); j++)
{
segs[i][j].Scale(iStartIndex, length, newLength);
}
}
// adjust BPM changes to preserve timing
if( bAdjustBPM )
@@ -1512,12 +1501,16 @@ bool TimingData::HasFakes() const
bool TimingData::HasSpeedChanges() const
{
return m_SpeedSegments.size()>1 || m_SpeedSegments[0].GetRatio() != 1;
const vector<TimingSegment *> &speeds = this->allTimingSegments[SEGMENT_SPEED];
return (speeds.size()>1 ||
static_cast<SpeedSegment *>(speeds[0])->GetRatio() != 1);
}
bool TimingData::HasScrollChanges() const
{
return m_ScrollSegments.size()>1 || m_ScrollSegments[0].GetRatio() != 1;
const vector<TimingSegment *> &scrolls = this->allTimingSegments[SEGMENT_SCROLL];
return (scrolls.size()>1 ||
static_cast<ScrollSegment *>(scrolls[0])->GetRatio() != 1);
}
void TimingData::NoteRowToMeasureAndBeat( int iNoteRow, int &iMeasureIndexOut, int &iBeatIndexOut, int &iRowsRemainder ) const
+24 -24
View File
@@ -72,13 +72,13 @@ public:
* @param iNoteRow the row that has a BPMSegment.
* @return the BPMSegment in question.
*/
BPMSegment& GetBPMSegmentAtRow( int iNoteRow );
BPMSegment* GetBPMSegmentAtRow( int iNoteRow );
/**
* @brief Retrieve the BPMSegment at the specified beat.
* @param fBeat the beat that has a BPMSegment.
* @return the BPMSegment in question.
*/
BPMSegment& GetBPMSegmentAtBeat( float fBeat ) { return GetBPMSegmentAtRow( (int)BeatToNoteRow(fBeat)); }
BPMSegment* GetBPMSegmentAtBeat( float fBeat ) { return GetBPMSegmentAtRow( (int)BeatToNoteRow(fBeat)); }
/**
* @brief Retrieve the next beat that contains a BPMSegment.
@@ -201,39 +201,39 @@ public:
* @param iNoteRow the row that has a StopSegment.
* @return the StopSegment in question.
*/
StopSegment& GetStopSegmentAtRow( int iNoteRow ) { return GetStopSegmentAtRow( iNoteRow, false ); }
StopSegment* GetStopSegmentAtRow( int iNoteRow ) { return GetStopSegmentAtRow( iNoteRow, false ); }
/**
* @brief Retrieve the StopSegment at the specified beat.
* @param fBeat the beat that has a StopSegment.
* @return the StopSegment in question.
*/
StopSegment& GetStopSegmentAtBeat( float fBeat ) { return GetStopSegmentAtRow( BeatToNoteRow(fBeat), false); }
StopSegment* GetStopSegmentAtBeat( float fBeat ) { return GetStopSegmentAtRow( BeatToNoteRow(fBeat), false); }
/**
* @brief Retrieve the StopSegment at the specified row.
* @param iNoteRow the row that has a StopSegment.
* @param bDelay If true, this is actually a DelaySegment.
* @return the StopSegment in question.
*/
StopSegment& GetStopSegmentAtRow( int iNoteRow, bool bDelay );
StopSegment* GetStopSegmentAtRow( int iNoteRow, bool bDelay );
/**
* @brief Retrieve the StopSegment at the specified beat.
* @param fBeat the beat that has a StopSegment.
* @param bDelay If true, this is actually a DelaySegment.
* @return the StopSegment in question.
*/
StopSegment& GetStopSegmentAtBeat( float fBeat, bool bDelay ) { return GetStopSegmentAtRow( BeatToNoteRow(fBeat), bDelay ); }
StopSegment* GetStopSegmentAtBeat( float fBeat, bool bDelay ) { return GetStopSegmentAtRow( BeatToNoteRow(fBeat), bDelay ); }
/**
* @brief Retrieve the DelaySegment at the specified row.
* @param iNoteRow the row that has a DelaySegment.
* @return the DelaySegment in question.
*/
StopSegment& GetDelaySegmentAtRow( int iNoteRow ) { return GetStopSegmentAtRow( iNoteRow, true ); }
StopSegment* GetDelaySegmentAtRow( int iNoteRow ) { return GetStopSegmentAtRow( iNoteRow, true ); }
/**
* @brief Retrieve the DelaySegment at the specified beat.
* @param fBeat the beat that has a DelaySegment.
* @return the DelaySegment in question.
*/
StopSegment& GetDelaySegmentAtBeat( float fBeat ) { return GetStopSegmentAtRow( BeatToNoteRow(fBeat), true); }
StopSegment* GetDelaySegmentAtBeat( float fBeat ) { return GetStopSegmentAtRow( BeatToNoteRow(fBeat), true); }
/**
* @brief Retrieve the index of the StopSegments at the specified row.
* @param iNoteRow the row that has a StopSegment.
@@ -363,13 +363,13 @@ public:
* @param iNoteRow the row that has a TimeSignatureSegment.
* @return the TimeSignatureSegment in question.
*/
TimeSignatureSegment& GetTimeSignatureSegmentAtRow( int iNoteRow );
TimeSignatureSegment* GetTimeSignatureSegmentAtRow( int iNoteRow );
/**
* @brief Retrieve the TimeSignatureSegment at the specified beat.
* @param fBeat the beat that has a TimeSignatureSegment.
* @return the TimeSignatureSegment in question.
*/
TimeSignatureSegment& GetTimeSignatureSegmentAtBeat( float fBeat ) { return GetTimeSignatureSegmentAtRow( BeatToNoteRow(fBeat) ); }
TimeSignatureSegment* GetTimeSignatureSegmentAtBeat( float fBeat ) { return GetTimeSignatureSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
@@ -432,13 +432,13 @@ public:
* @param iRow the row to focus on.
* @return the WarpSegment in question.
*/
WarpSegment& GetWarpSegmentAtRow( int iRow );
WarpSegment* GetWarpSegmentAtRow( int iRow );
/**
* @brief Retrieve the WarpSegment at the specified beat.
* @param fBeat the beat to focus on.
* @return the WarpSegment in question.
*/
WarpSegment& GetWarpSegmentAtBeat( float fBeat ) { return GetWarpSegmentAtRow( BeatToNoteRow( fBeat ) ); }
WarpSegment* GetWarpSegmentAtBeat( float fBeat ) { return GetWarpSegmentAtRow( BeatToNoteRow( fBeat ) ); }
/**
* @brief Checks if the row is inside a warp.
* @param iRow the row to focus on.
@@ -513,13 +513,13 @@ public:
* @param iNoteRow the row that has a TickcountSegment.
* @return the TickcountSegment in question.
*/
TickcountSegment& GetTickcountSegmentAtRow( int iNoteRow );
TickcountSegment* GetTickcountSegmentAtRow( int iNoteRow );
/**
* @brief Retrieve the TickcountSegment at the specified beat.
* @param fBeat the beat that has a TickcountSegment.
* @return the TickcountSegment in question.
*/
TickcountSegment& GetTickcountSegmentAtBeat( float fBeat ) { return GetTickcountSegmentAtRow( BeatToNoteRow(fBeat) ); }
TickcountSegment* GetTickcountSegmentAtBeat( float fBeat ) { return GetTickcountSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the next beat that contains a TickcountSegment.
@@ -632,13 +632,13 @@ public:
* @param iNoteRow the row that has a ComboSegment.
* @return the ComboSegment in question.
*/
ComboSegment& GetComboSegmentAtRow( int iNoteRow );
ComboSegment* GetComboSegmentAtRow( int iNoteRow );
/**
* @brief Retrieve the ComboSegment at the specified beat.
* @param fBeat the beat that has a ComboSegment.
* @return the ComboSegment in question.
*/
ComboSegment& GetComboSegmentAtBeat( float fBeat ) { return GetComboSegmentAtRow( BeatToNoteRow(fBeat) ); }
ComboSegment* GetComboSegmentAtBeat( float fBeat ) { return GetComboSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the next beat that contains a ComboSegment.
@@ -701,13 +701,13 @@ public:
* @param iNoteRow the row that has a LabelSegment.
* @return the LabelSegment in question.
*/
LabelSegment& GetLabelSegmentAtRow( int iNoteRow );
LabelSegment* GetLabelSegmentAtRow( int iNoteRow );
/**
* @brief Retrieve the LabelSegment at the specified beat.
* @param fBeat the beat that has a LabelSegment.
* @return the LabelSegment in question.
*/
LabelSegment& GetLabelSegmentAtBeat( float fBeat ) { return GetLabelSegmentAtRow( BeatToNoteRow(fBeat) ); }
LabelSegment* GetLabelSegmentAtBeat( float fBeat ) { return GetLabelSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the previous beat that contains a LabelSegment.
@@ -841,13 +841,13 @@ public:
* @param iNoteRow the row that has a SpeedSegment.
* @return the SpeedSegment in question.
*/
SpeedSegment& GetSpeedSegmentAtRow( int iNoteRow );
SpeedSegment* GetSpeedSegmentAtRow( int iNoteRow );
/**
* @brief Retrieve the SpeedSegment at the specified beat.
* @param fBeat the beat that has a SpeedSegment.
* @return the SpeedSegment in question.
*/
SpeedSegment& GetSpeedSegmentAtBeat( float fBeat ) { return GetSpeedSegmentAtRow( BeatToNoteRow(fBeat) ); }
SpeedSegment* GetSpeedSegmentAtBeat( float fBeat ) { return GetSpeedSegmentAtRow( BeatToNoteRow(fBeat) ); }
float GetDisplayedSpeedPercent( float fBeat, float fMusicSeconds ) const;
@@ -914,13 +914,13 @@ public:
* @param iNoteRow the row that has a ScrollSegment.
* @return the ScrollSegment in question.
*/
ScrollSegment& GetScrollSegmentAtRow( int iNoteRow );
ScrollSegment* GetScrollSegmentAtRow( int iNoteRow );
/**
* @brief Retrieve the ScrollSegment at the specified beat.
* @param fBeat the beat that has a ScrollSegment.
* @return the ScrollSegment in question.
*/
ScrollSegment& GetScrollSegmentAtBeat( float fBeat ) { return GetScrollSegmentAtRow( BeatToNoteRow(fBeat) ); }
ScrollSegment* GetScrollSegmentAtBeat( float fBeat ) { return GetScrollSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the next beat that contains a ScrollSegment.
@@ -983,13 +983,13 @@ public:
* @param iRow the row to focus on.
* @return the FakeSegment in question.
*/
FakeSegment& GetFakeSegmentAtRow( int iRow );
FakeSegment* GetFakeSegmentAtRow( int iRow );
/**
* @brief Retrieve the FakeSegment at the specified beat.
* @param fBeat the beat to focus on.
* @return the FakeSegment in question.
*/
FakeSegment& GetFakeSegmentAtBeat( float fBeat ) { return GetFakeSegmentAtRow( BeatToNoteRow( fBeat ) ); }
FakeSegment* GetFakeSegmentAtBeat( float fBeat ) { return GetFakeSegmentAtRow( BeatToNoteRow( fBeat ) ); }
/**
* @brief Checks if the row is inside a fake.
* @param iRow the row to focus on.