simplify, and handle songs with a #SAMPLESTART but no

#SAMPLELENGTH
This commit is contained in:
Glenn Maynard
2003-03-08 19:59:30 +00:00
parent 030f346f44
commit 86b0b1e7d7
+4 -7
View File
@@ -96,7 +96,7 @@ Song::Song()
m_bChangedSinceSave = false; m_bChangedSinceSave = false;
m_fBeat0OffsetInSeconds = 0; m_fBeat0OffsetInSeconds = 0;
m_fMusicSampleStartSeconds = 0; m_fMusicSampleStartSeconds = 0;
m_fMusicSampleLengthSeconds = 0; m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH;
m_iMusicBytes = 0; m_iMusicBytes = 0;
m_fMusicLengthSeconds = 0; m_fMusicLengthSeconds = 0;
m_fFirstBeat = -1; m_fFirstBeat = -1;
@@ -492,20 +492,17 @@ void Song::TidyUpData()
} }
/* Only automatically set the sample time if there was no sample length /* Only automatically set the sample time if there was no sample length
* (m_fMusicSampleLengthSeconds == 0). We don't want to test * (m_fMusicSampleStartSeconds == -1). We don't want to test
* if m_fMusicSampleStartSeconds == 0, since some people really do want * if m_fMusicSampleStartSeconds == 0, since some people really do want
* the sample to start at the very beginning of the song. (Of course, * the sample to start at the very beginning of the song. */
* this assumes nobody wants to have a song with no sample, but I can't
* think of any reason to do that ...) */
// We're going to try and do something intelligent here... // We're going to try and do something intelligent here...
// The MusicSampleStart always seems to be about 100-120 beats into // The MusicSampleStart always seems to be about 100-120 beats into
// the song regardless of BPM. Let's take a shot-in-the dark guess. // the song regardless of BPM. Let's take a shot-in-the dark guess.
if( m_fMusicSampleLengthSeconds == 0 || if( m_fMusicSampleStartSeconds == -1 ||
m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds ) m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds )
{ {
m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( 100 ); m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( 100 );
m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH;
if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds ) if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds )
{ {