[timing] More abstraction.

This commit has 2 caveats.

1) Stops and Delays are treated the same in the editor right now.
2) TimingSegments.cpp: XToString should not require NUM_TimingSegmentTypes.

Ideas?
This commit is contained in:
Jason Felds
2011-07-14 23:54:06 -04:00
parent 6f5ab98dec
commit 01dacd9746
6 changed files with 86 additions and 757 deletions
+13 -96
View File
@@ -812,7 +812,7 @@ void ScreenEdit::Init()
InitEditMappings();
currentCycleSegment = "label";
currentCycleSegment = SEGMENT_LABEL;
// save the originals for reverting later
CopyToLastSave();
@@ -1261,7 +1261,7 @@ void ScreenEdit::UpdateTextInfo()
sText += ssprintf( MAIN_TITLE_FORMAT.GetValue(), MAIN_TITLE.GetValue().c_str(), m_pSong->m_sMainTitle.c_str() );
if( m_pSong->m_sSubTitle.size() )
sText += ssprintf( SUBTITLE_FORMAT.GetValue(), SUBTITLE.GetValue().c_str(), m_pSong->m_sSubTitle.c_str() );
sText += ssprintf( SEGMENT_TYPE_FORMAT.GetValue(), SEGMENT_TYPE.GetValue().c_str(), currentCycleSegment.c_str() );
sText += ssprintf( SEGMENT_TYPE_FORMAT.GetValue(), SEGMENT_TYPE.GetValue().c_str(), TimingSegmentTypeToString(currentCycleSegment).c_str() );
sText += ssprintf( TAP_NOTE_TYPE_FORMAT.GetValue(), TAP_NOTE_TYPE.GetValue().c_str(), TapNoteTypeToString( m_selectedTap.type ).c_str() );
break;
}
@@ -1559,60 +1559,15 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
}
case EDIT_BUTTON_CYCLE_SEGMENT_LEFT:
{
if (this->currentCycleSegment == "label")
this->currentCycleSegment = "fake";
else if (this->currentCycleSegment == "fake")
this->currentCycleSegment = "scroll";
else if (this->currentCycleSegment == "scroll")
this->currentCycleSegment = "speed";
else if (this->currentCycleSegment == "speed")
this->currentCycleSegment = "combo";
else if (this->currentCycleSegment == "combo")
this->currentCycleSegment = "tickcount";
else if (this->currentCycleSegment == "tickcount")
this->currentCycleSegment = "timeSig";
else if (this->currentCycleSegment == "timeSig")
this->currentCycleSegment = "warp";
else if (this->currentCycleSegment == "warp")
this->currentCycleSegment = "delay";
else if (this->currentCycleSegment == "delay")
this->currentCycleSegment = "stop";
else if (this->currentCycleSegment == "stop")
this->currentCycleSegment = "bpm";
else if (this->currentCycleSegment == "bpm")
this->currentCycleSegment = "label";
// fallback gracefully instead of assert.
else this->currentCycleSegment = "label";
int tmp = enum_add2( this->currentCycleSegment, -1 );
wrap( *ConvertValue<int>(&tmp), NUM_TimingSegmentTypes );
break;
}
case EDIT_BUTTON_CYCLE_SEGMENT_RIGHT:
{
if (this->currentCycleSegment == "label")
this->currentCycleSegment = "bpm";
else if (this->currentCycleSegment == "bpm")
this->currentCycleSegment = "stop";
else if (this->currentCycleSegment == "stop")
this->currentCycleSegment = "delay";
else if (this->currentCycleSegment == "delay")
this->currentCycleSegment = "warp";
else if (this->currentCycleSegment == "warp")
this->currentCycleSegment = "timeSig";
else if (this->currentCycleSegment == "timeSig")
this->currentCycleSegment = "tickcount";
else if (this->currentCycleSegment == "tickcount")
this->currentCycleSegment = "combo";
else if (this->currentCycleSegment == "combo")
this->currentCycleSegment = "speed";
else if (this->currentCycleSegment == "speed")
this->currentCycleSegment = "scroll";
else if (this->currentCycleSegment == "scroll")
this->currentCycleSegment = "fake";
else if (this->currentCycleSegment == "fake")
this->currentCycleSegment = "label";
// fallback gracefully instead of assert.
else this->currentCycleSegment = "label";
break;
}
int tmp = enum_add2( this->currentCycleSegment, +1 );
wrap( *ConvertValue<int>(&tmp), NUM_TimingSegmentTypes );
break; }
case EDIT_BUTTON_SCROLL_SPEED_UP:
case EDIT_BUTTON_SCROLL_SPEED_DOWN:
{
@@ -1729,56 +1684,18 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
break;
case EDIT_BUTTON_SEGMENT_NEXT:
{
// TODO: Work around Stops and Delays. We MAY have to separate them.
TimingData &timing = GetAppropriateTiming();
if (this->currentCycleSegment == "label")
ScrollTo(timing.GetNextLabelSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "bpm")
ScrollTo(timing.GetNextBPMSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "stop")
ScrollTo(timing.GetNextStopSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "delay")
ScrollTo(timing.GetNextDelaySegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "warp")
ScrollTo(timing.GetNextWarpSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "timeSig")
ScrollTo(timing.GetNextTimeSignatureSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "tickcount")
ScrollTo(timing.GetNextTickcountSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "combo")
ScrollTo(timing.GetNextComboSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "speed")
ScrollTo(timing.GetNextSpeedSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "scroll")
ScrollTo(timing.GetNextScrollSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "fake")
ScrollTo(timing.GetNextFakeSegmentBeatAtBeat(GetBeat()));
ScrollTo(timing.GetNextSegmentBeatAtBeat(this->currentCycleSegment,
GetBeat()));
}
break;
case EDIT_BUTTON_SEGMENT_PREV:
{
// TODO: Work around Stops and Delays. We MAY have to separate them.
TimingData &timing = GetAppropriateTiming();
if (this->currentCycleSegment == "label")
ScrollTo(timing.GetPreviousLabelSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "bpm")
ScrollTo(timing.GetPreviousBPMSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "stop")
ScrollTo(timing.GetPreviousStopSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "delay")
ScrollTo(timing.GetPreviousDelaySegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "warp")
ScrollTo(timing.GetPreviousWarpSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "timeSig")
ScrollTo(timing.GetPreviousTimeSignatureSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "tickcount")
ScrollTo(timing.GetPreviousTickcountSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "combo")
ScrollTo(timing.GetPreviousComboSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "speed")
ScrollTo(timing.GetPreviousSpeedSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "scroll")
ScrollTo(timing.GetPreviousScrollSegmentBeatAtBeat(GetBeat()));
else if (this->currentCycleSegment == "fake")
ScrollTo(timing.GetPreviousFakeSegmentBeatAtBeat(GetBeat()));
ScrollTo(timing.GetPreviousSegmentBeatAtBeat(this->currentCycleSegment,
GetBeat()));
}
break;
case EDIT_BUTTON_SNAP_NEXT:
+1 -1
View File
@@ -286,7 +286,7 @@ protected:
TapNote m_selectedTap;
/** @brief The type of segment users will jump back and forth between. */
RString currentCycleSegment;
TimingSegmentType currentCycleSegment;
void UpdateTextInfo();
BitmapText m_textInfo; // status information that changes
+35 -308
View File
@@ -64,6 +64,41 @@ int TimingData::GetSegmentIndexAtRow(TimingSegmentType tst,
return static_cast<int>(i);
}
float TimingData::GetNextSegmentBeatAtRow(TimingSegmentType tst,
int row, bool isDelay) const
{
const vector<TimingSegment *> segs = this->allTimingSegments[tst];
for (unsigned i = 0; i < segs.size(); i++ )
{
if( segs[i]->GetRow() <= row )
{
continue;
}
if (tst != SEGMENT_STOP_DELAY ||
static_cast<StopSegment *>(segs[i])->GetDelay() == isDelay)
return segs[i]->GetBeat();
}
return NoteRowToBeat(row);
}
float TimingData::GetPreviousSegmentBeatAtRow(TimingSegmentType tst,
int row, bool isDelay) const
{
float backup = -1;
const vector<TimingSegment *> segs = this->allTimingSegments[tst];
for (unsigned i = 0; i < segs.size(); i++ )
{
if( segs[i]->GetRow() >= row )
{
break;
}
if (tst != SEGMENT_STOP_DELAY ||
static_cast<StopSegment *>(segs[i])->GetDelay() == isDelay)
backup = segs[i]->GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(row);
}
// TODO: Find a way to combine all of these SetAtRows to one.
/* Change an existing BPM segment, merge identical segments together or insert a new one. */
@@ -715,314 +750,6 @@ int TimingData::GetTickcountAtRow( int iRow ) const
return static_cast<TickcountSegment *>(ticks[index])->GetTicks();
}
float TimingData::GetPreviousBPMSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_BPMSegments.size(); i++ )
{
if( m_BPMSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_BPMSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextBPMSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_BPMSegments.size(); i++ )
{
if( m_BPMSegments[i].GetRow() <= iRow )
{
continue;
}
return m_BPMSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousStopSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_StopSegments.size(); i++ )
{
const StopSegment &s = m_StopSegments[i];
if( s.GetRow() >= iRow )
{
break;
}
if (!s.GetDelay())
backup = s.GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextStopSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_StopSegments.size(); i++ )
{
const StopSegment &s = m_StopSegments[i];
if( s.GetRow() <= iRow )
{
continue;
}
if (!s.GetDelay())
return s.GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousDelaySegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_StopSegments.size(); i++ )
{
const StopSegment &s = m_StopSegments[i];
if( s.GetRow() >= iRow )
{
break;
}
if (s.GetDelay())
backup = s.GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextDelaySegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_StopSegments.size(); i++ )
{
const StopSegment &s = m_StopSegments[i];
if( s.GetRow() <= iRow )
{
continue;
}
if (s.GetDelay())
return s.GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousTimeSignatureSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_vTimeSignatureSegments.size(); i++ )
{
if( m_vTimeSignatureSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_vTimeSignatureSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextTimeSignatureSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_vTimeSignatureSegments.size(); i++ )
{
if( m_vTimeSignatureSegments[i].GetRow() <= iRow )
{
continue;
}
return m_vTimeSignatureSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousTickcountSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_TickcountSegments.size(); i++ )
{
if( m_TickcountSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_TickcountSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextTickcountSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_TickcountSegments.size(); i++ )
{
if( m_TickcountSegments[i].GetRow() <= iRow )
{
continue;
}
return m_TickcountSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousComboSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_ComboSegments.size(); i++ )
{
if( m_ComboSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_ComboSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextComboSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_ComboSegments.size(); i++ )
{
if( m_ComboSegments[i].GetRow() <= iRow )
{
continue;
}
return m_ComboSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousWarpSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_WarpSegments.size(); i++ )
{
if( m_WarpSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_WarpSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextWarpSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_WarpSegments.size(); i++ )
{
if( m_WarpSegments[i].GetRow() <= iRow )
{
continue;
}
return m_WarpSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousFakeSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_FakeSegments.size(); i++ )
{
if( m_FakeSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_FakeSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextFakeSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_FakeSegments.size(); i++ )
{
if( m_FakeSegments[i].GetRow() <= iRow )
{
continue;
}
return m_FakeSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousSpeedSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_SpeedSegments.size(); i++ )
{
if( m_SpeedSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_SpeedSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextSpeedSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_SpeedSegments.size(); i++ )
{
if( m_SpeedSegments[i].GetRow() <= iRow )
{
continue;
}
return m_SpeedSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousScrollSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_ScrollSegments.size(); i++ )
{
if( m_ScrollSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_ScrollSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextScrollSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_ScrollSegments.size(); i++ )
{
if( m_ScrollSegments[i].GetRow() <= iRow )
{
continue;
}
return m_ScrollSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
float TimingData::GetPreviousLabelSegmentBeatAtRow( int iRow ) const
{
float backup = -1;
for (unsigned i = 0; i < m_LabelSegments.size(); i++ )
{
if( m_LabelSegments[i].GetRow() >= iRow )
{
break;
}
backup = m_LabelSegments[i].GetBeat();
}
return (backup > -1) ? backup : NoteRowToBeat(iRow);
}
float TimingData::GetNextLabelSegmentBeatAtRow( int iRow ) const
{
for (unsigned i = 0; i < m_LabelSegments.size(); i++ )
{
if( m_LabelSegments[i].GetRow() <= iRow )
{
continue;
}
return m_LabelSegments[i].GetBeat();
}
return NoteRowToBeat(iRow);
}
bool TimingData::DoesLabelExist( RString sLabel ) const
{
const vector<TimingSegment *> &labels = this->allTimingSegments[SEGMENT_LABEL];
+19 -351
View File
@@ -27,6 +27,24 @@ public:
return this->GetSegmentIndexAtRow(tst, BeatToNoteRow(beat), isDelay);
}
float GetNextSegmentBeatAtRow(TimingSegmentType tst,
int row, bool isDelay = false) const;
float GetNextSegmentBeatAtBeat(TimingSegmentType tst,
float beat, bool isDelay = false) const
{
return this->GetNextSegmentBeatAtRow(tst, BeatToNoteRow(beat), isDelay);
}
float GetPreviousSegmentBeatAtRow(TimingSegmentType tst,
int row, bool isDelay = false) const;
float GetPreviousSegmentBeatAtBeat(TimingSegmentType tst,
float beat, bool isDelay = false) const
{
return this->GetPreviousSegmentBeatAtRow(tst, BeatToNoteRow(beat), isDelay);
}
/**
* @brief Sets up initial timing data with a defined offset.
* @param fOffset the offset from the 0th beat. */
@@ -79,38 +97,6 @@ public:
* @return the BPMSegment in question.
*/
BPMSegment* GetBPMSegmentAtBeat( float fBeat ) { return GetBPMSegmentAtRow( (int)BeatToNoteRow(fBeat)); }
/**
* @brief Retrieve the next beat that contains a BPMSegment.
* @param iRow the present row.
* @return the next beat with a BPMSegment, or fBeat if there is none ahead.
*/
float GetNextBPMSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a BPMSegment.
* @param fBeat the present beat.
* @return the next beat with a BPMSegment, or fBeat if there is none ahead.
*/
float GetNextBPMSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextBPMSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a BPMSegment.
* @param iRow the present row.
* @return the previous beat with a BPMSegment, or fBeat if there is none prior.
*/
float GetPreviousBPMSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a BPMSegment.
* @param fBeat the present beat.
* @return the previous beat with a BPMSegment, or fBeat if there is none prior.
*/
float GetPreviousBPMSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousBPMSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the Stop/Delay at the given row.
@@ -234,68 +220,7 @@ public:
* @return the DelaySegment in question.
*/
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.
* @return the StopSegment's index in question.
*/
float GetNextStopSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a StopSegment.
* @param fBeat the present beat.
* @return the next beat with a StopSegment, or fBeat if there is none ahead.
*/
float GetNextStopSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextStopSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a StopSegment.
* @param iRow the present row.
* @return the previous beat with a StopSegment, or fBeat if there is none prior.
*/
float GetPreviousStopSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a StopSegment.
* @param fBeat the present beat.
* @return the previous beat with a StopSegment, or fBeat if there is none prior.
*/
float GetPreviousStopSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousStopSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the next beat that contains a DelaySegment.
* @param iRow the present row.
* @return the next beat with a DelaySegment, or fBeat if there is none ahead.
*/
float GetNextDelaySegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a DelaySegment.
* @param fBeat the present beat.
* @return the next beat with a DelaySegment, or fBeat if there is none ahead.
*/
float GetNextDelaySegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextDelaySegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a DelaySegment.
* @param iRow the present row.
* @return the previous beat with a DelaySegment, or fBeat if there is none prior.
*/
float GetPreviousDelaySegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a DelaySegment.
* @param fBeat the present beat.
* @return the previous beat with a DelaySegment, or fBeat if there is none prior.
*/
float GetPreviousDelaySegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousDelaySegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the Time Signature's numerator at the given row.
* @param iNoteRow the row in question.
@@ -370,38 +295,6 @@ public:
* @return the TimeSignatureSegment in question.
*/
TimeSignatureSegment* GetTimeSignatureSegmentAtBeat( float fBeat ) { return GetTimeSignatureSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the next beat that contains a TimeSignatureSegment.
* @param iRow the present row.
* @return the next beat with a TimeSignatureSegment, or fBeat if there is none ahead.
*/
float GetNextTimeSignatureSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a TimeSignatureSegment.
* @param fBeat the present beat.
* @return the next beat with a TimeSignatureSegment, or fBeat if there is none ahead.
*/
float GetNextTimeSignatureSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextTimeSignatureSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a TimeSignatureSegment.
* @param iRow the present row.
* @return the previous beat with a TimeSignatureSegment, or fBeat if there is none prior.
*/
float GetPreviousTimeSignatureSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a TimeSignatureSegment.
* @param fBeat the present beat.
* @return the previous beat with a TimeSignatureSegment, or fBeat if there is none prior.
*/
float GetPreviousTimeSignatureSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousTimeSignatureSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Determine the beat to warp to.
@@ -452,38 +345,6 @@ public:
*/
bool IsWarpAtBeat( float fBeat ) const { return IsWarpAtRow( BeatToNoteRow( fBeat ) ); }
/**
* @brief Retrieve the next beat that contains a WarpSegment.
* @param iRow the present row.
* @return the next beat with a WarpSegment, or fBeat if there is none ahead.
*/
float GetNextWarpSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a WarpSegment.
* @param fBeat the present beat.
* @return the next beat with a WarpSegment, or fBeat if there is none ahead.
*/
float GetNextWarpSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextWarpSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a WarpSegment.
* @param iRow the present row.
* @return the previous beat with a WarpSegment, or fBeat if there is none prior.
*/
float GetPreviousWarpSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a WarpSegment.
* @param fBeat the present beat.
* @return the previous beat with a WarpSegment, or fBeat if there is none prior.
*/
float GetPreviousWarpSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousWarpSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the Tickcount at the given row.
* @param iNoteRow the row in question.
@@ -521,38 +382,6 @@ public:
*/
TickcountSegment* GetTickcountSegmentAtBeat( float fBeat ) { return GetTickcountSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the next beat that contains a TickcountSegment.
* @param iRow the present row.
* @return the next beat with a TickcountSegment, or fBeat if there is none ahead.
*/
float GetNextTickcountSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a TickcountSegment.
* @param fBeat the present beat.
* @return the next beat with a TickcountSegment, or fBeat if there is none ahead.
*/
float GetNextTickcountSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextTickcountSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a TickcountSegment.
* @param iRow the present row.
* @return the previous beat with a TickcountSegment, or fBeat if there is none prior.
*/
float GetPreviousTickcountSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a TickcountSegment.
* @param fBeat the present beat.
* @return the previous beat with a TickcountSegment, or fBeat if there is none prior.
*/
float GetPreviousTickcountSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousTickcountSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the Combo at the given row.
* @param iNoteRow the row in question.
@@ -640,38 +469,6 @@ public:
*/
ComboSegment* GetComboSegmentAtBeat( float fBeat ) { return GetComboSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the next beat that contains a ComboSegment.
* @param iRow the present row.
* @return the next beat with a ComboSegment, or fBeat if there is none ahead.
*/
float GetNextComboSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a ComboSegment.
* @param fBeat the present beat.
* @return the next beat with a ComboSegment, or fBeat if there is none ahead.
*/
float GetNextComboSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextComboSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a ComboSegment.
* @param iRow the present row.
* @return the previous beat with a ComboSegment, or fBeat if there is none prior.
*/
float GetPreviousComboSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a ComboSegment.
* @param fBeat the present beat.
* @return the previous beat with a ComboSegment, or fBeat if there is none prior.
*/
float GetPreviousComboSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousComboSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the Label at the given row.
* @param iNoteRow the row in question.
@@ -709,45 +506,12 @@ public:
*/
LabelSegment* GetLabelSegmentAtBeat( float fBeat ) { return GetLabelSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the previous beat that contains a LabelSegment.
* @param iRow the present row.
* @return the previous beat with a LabelSegment, or fBeat if there is none prior.
*/
float GetPreviousLabelSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a LabelSegment.
* @param fBeat the present beat.
* @return the previous beat with a LabelSegment, or fBeat if there is none prior.
*/
float GetPreviousLabelSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousLabelSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Determine if the requisite label already exists.
* @param sLabel the label to check.
* @return true if it exists, false otherwise. */
bool DoesLabelExist( RString sLabel ) const;
/**
* @brief Retrieve the next beat that contains a LabelSegment.
* @param iRow the present row.
* @return the next beat with a LabelSegment, or fBeat if there is none ahead.
*/
float GetNextLabelSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a LabelSegment.
* @param fBeat the present beat.
* @return the next beat with a LabelSegment, or fBeat if there is none ahead.
*/
float GetNextLabelSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextLabelSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the Speed's percent at the given row.
* @param iNoteRow the row in question.
@@ -851,38 +615,6 @@ public:
float GetDisplayedSpeedPercent( float fBeat, float fMusicSeconds ) const;
/**
* @brief Retrieve the next beat that contains a SpeedSegment.
* @param iRow the present row.
* @return the next beat with a SpeedSegment, or fBeat if there is none ahead.
*/
float GetNextSpeedSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a SpeedSegment.
* @param fBeat the present beat.
* @return the next beat with a SpeedSegment, or fBeat if there is none ahead.
*/
float GetNextSpeedSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextSpeedSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a SpeedSegment.
* @param iRow the present row.
* @return the previous beat with a SpeedSegment, or fBeat if there is none prior.
*/
float GetPreviousSpeedSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a SpeedSegment.
* @param fBeat the present beat.
* @return the previous beat with a SpeedSegment, or fBeat if there is none prior.
*/
float GetPreviousSpeedSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousSpeedSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the scrolling factor at the given row.
* @param iNoteRow the row in question.
@@ -922,38 +654,6 @@ public:
*/
ScrollSegment* GetScrollSegmentAtBeat( float fBeat ) { return GetScrollSegmentAtRow( BeatToNoteRow(fBeat) ); }
/**
* @brief Retrieve the next beat that contains a ScrollSegment.
* @param iRow the present row.
* @return the next beat with a ScrollSegment, or fBeat if there is none ahead.
*/
float GetNextScrollSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a ScrollSegment.
* @param fBeat the present beat.
* @return the next beat with a ScrollSegment, or fBeat if there is none ahead.
*/
float GetNextScrollSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextScrollSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a ScrollSegment.
* @param iRow the present row.
* @return the previous beat with a ScrollSegment, or fBeat if there is none prior.
*/
float GetPreviousScrollSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a ScrollSegment.
* @param fBeat the present beat.
* @return the previous beat with a ScrollSegment, or fBeat if there is none prior.
*/
float GetPreviousScrollSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousScrollSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Determine when the fakes end.
* @param iRow The row you start on.
@@ -1003,38 +703,6 @@ public:
*/
bool IsFakeAtBeat( float fBeat ) const { return IsFakeAtRow( BeatToNoteRow( fBeat ) ); }
/**
* @brief Retrieve the next beat that contains a FakeSegment.
* @param iRow the present row.
* @return the next beat with a FakeSegment, or fBeat if there is none ahead.
*/
float GetNextFakeSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a FakeSegment.
* @param fBeat the present beat.
* @return the next beat with a FakeSegment, or fBeat if there is none ahead.
*/
float GetNextFakeSegmentBeatAtBeat( float fBeat ) const
{
return this->GetNextFakeSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Retrieve the previous beat that contains a FakeSegment.
* @param iRow the present row.
* @return the previous beat with a FakeSegment, or fBeat if there is none prior.
*/
float GetPreviousFakeSegmentBeatAtRow( int iRow ) const;
/**
* @brief Retrieve the previous beat that contains a FakeSegment.
* @param fBeat the present beat.
* @return the previous beat with a FakeSegment, or fBeat if there is none prior.
*/
float GetPreviousFakeSegmentBeatAtBeat( float fBeat ) const
{
return this->GetPreviousFakeSegmentBeatAtRow( BeatToNoteRow(fBeat) );
}
/**
* @brief Determine if this notes on this row can be judged.
* @param row the row to focus on.
+15
View File
@@ -1,5 +1,20 @@
#include "global.h"
#include "TimingSegments.h"
#include "EnumHelper.h"
static const char *TimingSegmentTypeNames[] = {
"BPM",
"Stop/Delay", // TODO: separate when stops and delays are separate.
"Time Sig",
"Warp",
"Label",
"Tickcount",
"Combo",
"Speed",
"Scroll",
"Fake"
};
XToString( TimingSegmentType );
#define LTCOMPARE(x) if(this->x < other.x) return true; if(this->x > other.x) return false;
+3 -1
View File
@@ -18,9 +18,11 @@ enum TimingSegmentType
SEGMENT_SPEED,
SEGMENT_SCROLL,
SEGMENT_FAKE,
NUM_TimingSegmentTypes
NUM_TimingSegmentTypes,
};
const RString& TimingSegmentTypeToString( TimingSegmentType tst );
/**
* @brief The base timing segment for all of the changing glory.
*/