add time-based spacing and variable scroll speed (commented out because it wasn't as helpful as I hoped)

This commit is contained in:
Chris Danford
2003-04-16 22:49:40 +00:00
parent 3c6ed5a9ed
commit 25ef2863e0
11 changed files with 162 additions and 75 deletions
+24
View File
@@ -1292,3 +1292,27 @@ void Song::RemoveNotes( Notes* pNotes )
AddAutoGenNotes();
}
float Song::GetDominantBPM()
{
// Get the average BPM.
// TODO: Make this return the most-used BPM in the song.
// This is tricky though because many songs with BPM changes
// have tweaked BPMs (e.g. 160BPM at first, then 160.05BPM later).
float fSumBPM = 0;
float fSumWeights = 0;
for( unsigned i=0; i<m_BPMSegments.size(); i++ )
{
float fBPM = m_BPMSegments[i].m_fBPM;
bool bIsLast = i==m_BPMSegments.size()-1;
float fLength;
if( bIsLast )
fLength = m_fLastBeat - m_BPMSegments[i].m_fStartBeat;
else
fLength = m_BPMSegments[i+1].m_fStartBeat - m_BPMSegments[i].m_fStartBeat;
ASSERT( fLength > 0 );
fSumBPM += fBPM * fLength;
fSumWeights += fLength;
}
return fSumBPM / fSumWeights;
}