From 86b0b1e7d7d66085ced851e826deec2fe26f3974 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sat, 8 Mar 2003 19:59:30 +0000 Subject: [PATCH] simplify, and handle songs with a #SAMPLESTART but no #SAMPLELENGTH --- stepmania/src/Song.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/stepmania/src/Song.cpp b/stepmania/src/Song.cpp index b00b597c69..cfa8be5530 100644 --- a/stepmania/src/Song.cpp +++ b/stepmania/src/Song.cpp @@ -96,7 +96,7 @@ Song::Song() m_bChangedSinceSave = false; m_fBeat0OffsetInSeconds = 0; m_fMusicSampleStartSeconds = 0; - m_fMusicSampleLengthSeconds = 0; + m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH; m_iMusicBytes = 0; m_fMusicLengthSeconds = 0; m_fFirstBeat = -1; @@ -492,20 +492,17 @@ void Song::TidyUpData() } /* 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 - * the sample to start at the very beginning of the song. (Of course, - * this assumes nobody wants to have a song with no sample, but I can't - * think of any reason to do that ...) */ + * the sample to start at the very beginning of the song. */ // We're going to try and do something intelligent here... // 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. - if( m_fMusicSampleLengthSeconds == 0 || + if( m_fMusicSampleStartSeconds == -1 || m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds ) { m_fMusicSampleStartSeconds = this->GetElapsedTimeFromBeat( 100 ); - m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH; if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds ) {