Make sure the first BPM segment starts at beat 0.

round sample music for short songs to a measure, not 10 beats
This commit is contained in:
Glenn Maynard
2004-12-03 01:16:14 +00:00
parent c072b260f6
commit 0d608c0806
+6 -16
View File
@@ -523,16 +523,11 @@ void Song::TidyUpData()
m_Timing.AddBPMSegment( BPMSegment(0, 60) ); m_Timing.AddBPMSegment( BPMSegment(0, 60) );
} }
/* Only automatically set the sample time if there was no sample length /* Make sure the first BPM segment starts at beat 0. */
* (m_fMusicSampleStartSeconds == -1). */ if( m_Timing.m_BPMSegments[0].m_fStartBeat != 0 )
/* We don't want to test if m_fMusicSampleStartSeconds == 0, since some m_Timing.m_BPMSegments[0].m_fStartBeat = 0;
* people really do want the sample to start at the very beginning of the song. */
/* Having a sample start of 0 sounds terrible for most songs because because
* of the silence at the beginning. Many of my files have a 0 for the
* sample start that was not manually set, and I assume other people have the same.
* If there are complaints atou manually-set sample start at 0 is being ignored,
* then change this back. -Chris */
if( m_fMusicSampleStartSeconds == -1 || if( m_fMusicSampleStartSeconds == -1 ||
m_fMusicSampleStartSeconds == 0 || m_fMusicSampleStartSeconds == 0 ||
m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds ) m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds )
@@ -541,13 +536,8 @@ void Song::TidyUpData()
if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds ) if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds )
{ {
// fix for BAG and other slow songs int iBeat = lrintf( m_fLastBeat/2 );
int iBeat = (int)(m_fLastBeat/2); iBeat -= iBeat%4;
/* Er. I see that this truncates the beat down to a multiple
* of 10, but what's the logic behind doing that? (It'd make
* sense to use a multiple of 4, so we try to line up to a
* measure ...) -glenn */
iBeat = iBeat - iBeat%10;
m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( (float)iBeat ); m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( (float)iBeat );
} }
} }