optimize GetNumTapNotes

This commit is contained in:
Glenn Maynard
2002-12-14 20:34:38 +00:00
parent 689e9b150d
commit fb942385b8
+6 -3
View File
@@ -236,16 +236,19 @@ float NoteData::GetLastBeat() const
int NoteData::GetNumTapNotes( const float fStartBeat, const float fEndBeat ) const int NoteData::GetNumTapNotes( const float fStartBeat, const float fEndBeat ) const
{ {
int iNumNotes = 0; int iNumNotes = 0;
int iStartIndex = BeatToNoteRow( fStartBeat ); int iStartIndex = BeatToNoteRow( fStartBeat );
int iEndIndex = BeatToNoteRow( fEndBeat ); int iEndIndex = BeatToNoteRow( fEndBeat );
if(fEndBeat == MAX_BEATS)
iEndIndex = min(iEndIndex, int(m_TapNotes[0].size()));
for( int i=iStartIndex; i<min(iEndIndex, MAX_TAP_NOTE_ROWS); i++ )
{
for( int t=0; t<m_iNumTracks; t++ ) for( int t=0; t<m_iNumTracks; t++ )
{
for( int i=iStartIndex; i<iEndIndex; i++ )
{
if( GetTapNote(t, i) != TAP_EMPTY ) if( GetTapNote(t, i) != TAP_EMPTY )
iNumNotes++; iNumNotes++;
} }
}
return iNumNotes; return iNumNotes;
} }