From 720e625b77dcf9e8051df9f7e625e46f6ff7767c Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Sun, 11 Jan 2004 10:38:38 +0000 Subject: [PATCH] music start fixes --- stepmania/src/RageSounds.cpp | 9 ++------- stepmania/src/RageSounds.h | 2 +- stepmania/src/ScreenSelectMusic.cpp | 6 ++++-- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/stepmania/src/RageSounds.cpp b/stepmania/src/RageSounds.cpp index f7649222e8..4ed77ec368 100644 --- a/stepmania/src/RageSounds.cpp +++ b/stepmania/src/RageSounds.cpp @@ -34,7 +34,6 @@ struct MusicToPlay CString file; TimingData timing; bool HasTiming; - CString timing_file; bool force_loop; float start_sec, length_sec, fade_len; }; @@ -69,10 +68,7 @@ void StartQueuedMusic( const RageTimer &when ) if( g_MusicToPlay.force_loop ) g_Music->SetStopMode( RageSound::M_LOOP ); - if( g_MusicToPlay.start_sec == -1 ) - g_Music->SetStartSeconds(); - else - g_Music->SetStartSeconds( g_MusicToPlay.start_sec ); + g_Music->SetStartSeconds( g_MusicToPlay.start_sec ); if( g_MusicToPlay.length_sec == -1 ) g_Music->SetLengthSeconds(); @@ -149,7 +145,6 @@ void RageSounds::PlayMusic( const CString &file, const CString &timing_file, boo g_Music->Unload(); g_MusicToPlay.file = file; - g_MusicToPlay.timing_file = timing_file; g_MusicToPlay.force_loop = force_loop; g_MusicToPlay.start_sec = start_sec; g_MusicToPlay.length_sec = length_sec; @@ -182,7 +177,7 @@ void RageSounds::PlayMusic( const CString &file, const CString &timing_file, boo } } - if( g_MusicToPlay.HasTiming && force_loop ) + if( g_MusicToPlay.HasTiming && force_loop && length_sec != -1 ) { float fStartBeat = g_MusicToPlay.timing.GetBeatFromElapsedTime( g_MusicToPlay.start_sec ); float fEndSec = start_sec + length_sec; diff --git a/stepmania/src/RageSounds.h b/stepmania/src/RageSounds.h index 4762feb0c6..44ba1b7249 100644 --- a/stepmania/src/RageSounds.h +++ b/stepmania/src/RageSounds.h @@ -10,7 +10,7 @@ public: ~RageSounds(); void Update( float fDeltaTime ); - void PlayMusic( const CString &file, bool force_loop = false, float start_sec = -1, float length_sec = -1, float fade_len = 0 ) { PlayMusic( file, "", force_loop, start_sec, length_sec, fade_len ); } + void PlayMusic( const CString &file, bool force_loop = false, float start_sec = 0, float length_sec = -1, float fade_len = 0 ) { PlayMusic( file, "", force_loop, start_sec, length_sec, fade_len ); } void PlayMusic( const CString &file, const CString &timing_file, bool force_loop = false, float start_sec = -1, float length_sec = -1, float fade_len = 0 ); void StopMusic() { PlayMusic(""); } CString GetMusicPath() const; diff --git a/stepmania/src/ScreenSelectMusic.cpp b/stepmania/src/ScreenSelectMusic.cpp index fcb3ba0e85..6cd0fd55a2 100644 --- a/stepmania/src/ScreenSelectMusic.cpp +++ b/stepmania/src/ScreenSelectMusic.cpp @@ -1211,7 +1211,8 @@ void ScreenSelectMusic::AfterMusicChange() m_sprCDTitleBack.UnloadTexture(); m_DifficultyDisplay.UnsetDifficulties(); - m_fSampleStartSeconds = m_fSampleLengthSeconds = -1; + m_fSampleStartSeconds = 0; + m_fSampleLengthSeconds = -1; switch( m_MusicWheel.GetSelectedType() ) { case TYPE_SECTION: @@ -1308,7 +1309,8 @@ void ScreenSelectMusic::AfterMusicChange() m_sprCDTitleBack.UnloadTexture(); m_DifficultyDisplay.UnsetDifficulties(); - m_fSampleStartSeconds = m_fSampleLengthSeconds = -1; + m_fSampleStartSeconds = 0; + m_fSampleLengthSeconds = -1; switch( m_MusicWheel.GetSelectedType() ) { case TYPE_ROULETTE: