TimingData::MultiplyBPMInBeatRange

This commit is contained in:
Glenn Maynard
2004-11-08 22:24:18 +00:00
parent 2aa43ea93c
commit 422b1defb7
2 changed files with 18 additions and 0 deletions
+17
View File
@@ -76,6 +76,23 @@ void TimingData::SetBPMAtBeat( float fBeat, float fBPM )
}
}
/* Multiply the BPM in the range [fStartBeat,fEndBeat) by fFactor. */
void TimingData::MultiplyBPMInBeatRange( float fStartBeat, float fEndBeat, float fFactor )
{
/* Record the BPM at fEndBeat, so we can make sure it doesn't change. */
float fEndBPM = GetBPMAtBeat( fEndBeat );
/* Set the first beat. */
SetBPMAtBeat( fStartBeat, GetBPMAtBeat(fStartBeat) * fFactor );
/* Change all other BPM segments in this range. */
for( unsigned i=0; i<m_BPMSegments.size(); i++ )
if( m_BPMSegments[i].m_fStartBeat > fStartBeat && m_BPMSegments[i].m_fStartBeat < fEndBeat )
m_BPMSegments[i].m_fBPM *= fFactor;
/* Don't change the BPM at the end of the range. */
SetBPMAtBeat( fEndBeat, fEndBPM );
}
float TimingData::GetBPMAtBeat( float fBeat ) const
{
+1
View File
@@ -27,6 +27,7 @@ public:
void GetActualBPM( float &fMinBPMOut, float &fMaxBPMOut ) const;
float GetBPMAtBeat( float fBeat ) const;
void SetBPMAtBeat( float fBeat, float fBPM );
void MultiplyBPMInBeatRange( float fStartBeat, float fEndBeat, float fFactor );
void AddBPMSegment( const BPMSegment &seg );
void AddStopSegment( const StopSegment &seg );
BPMSegment& GetBPMSegmentAtBeat( float fBeat );