optimize and clean up a little

This commit is contained in:
Glenn Maynard
2003-02-25 19:49:16 +00:00
parent 0b0f154a5e
commit 38118ab10d
2 changed files with 14 additions and 6 deletions
+6 -3
View File
@@ -255,10 +255,11 @@ float NoteData::GetLastBeat() const
return fOldestBeatFoundSoFar;
}
int NoteData::GetNumTapNotes( const float fStartBeat, const float fEndBeat ) const
int NoteData::GetNumTapNotes( float fStartBeat, float fEndBeat ) const
{
int iNumNotes = 0;
if(fEndBeat == -1) fEndBeat = GetMaxBeat();
int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
@@ -274,10 +275,11 @@ int NoteData::GetNumTapNotes( const float fStartBeat, const float fEndBeat ) con
return iNumNotes;
}
int NoteData::GetNumDoubles( const float fStartBeat, const float fEndBeat ) const
int NoteData::GetNumDoubles( float fStartBeat, float fEndBeat ) const
{
int iNumDoubles = 0;
if(fEndBeat == -1) fEndBeat = GetMaxBeat();
int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat );
@@ -296,10 +298,11 @@ int NoteData::GetNumDoubles( const float fStartBeat, const float fEndBeat ) cons
return iNumDoubles;
}
int NoteData::GetNumHoldNotes( const float fStartBeat, const float fEndBeat ) const
int NoteData::GetNumHoldNotes( float fStartBeat, float fEndBeat ) const
{
int iNumHolds = 0;
if(fEndBeat == -1) fEndBeat = GetMaxBeat();
for( int i=0; i<GetNumHoldNotes(); i++ )
{
const HoldNote &hn = GetHoldNote(i);
+8 -3
View File
@@ -107,14 +107,19 @@ public:
// statistics
bool IsThereANoteAtRow( int iRow ) const;
/* Return the highest beat/row that might contain notes. (Use GetLastBeat if you need
* accuracy.) */
float GetMaxBeat() const { return NoteRowToBeat(GetMaxRow()); }
int GetMaxRow() const { return int(m_TapNotes[0].size()); }
float GetFirstBeat() const; // return the beat number of the first note
int GetFirstRow() const;
float GetLastBeat() const; // return the beat number of the last note
int GetLastRow() const;
int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ) const;
int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = MAX_BEATS ) const;
int GetNumTapNotes( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
int GetNumDoubles( const float fStartBeat = 0, const float fEndBeat = -1 ) const;
/* optimization: for the default of start to end, use the second (faster) */
int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = MAX_BEATS ) const;
int GetNumHoldNotes( const float fStartBeat, const float fEndBeat = -1 ) const;
int GetNumHoldNotes() const { return m_HoldNotes.size(); }
int GetPossibleDancePoints();