From ead9944ac64f90aa3ae9927455dc890fdfecb369 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Thu, 19 Dec 2002 04:08:38 +0000 Subject: [PATCH] update --- stepmania/src/RageSound.cpp | 15 +++++++++++---- stepmania/src/RageSound.h | 3 +++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/stepmania/src/RageSound.cpp b/stepmania/src/RageSound.cpp index 51e278c24d..e9f3f4ea73 100644 --- a/stepmania/src/RageSound.cpp +++ b/stepmania/src/RageSound.cpp @@ -79,7 +79,7 @@ RageSound::RageSound() stream.buf.reserve(internal_buffer_size); m_StartSeconds = 0; m_LengthSeconds = -1; - + AccurateSync = false; /* Register ourselves, so we receive Update()s. */ SOUNDMAN->all_sounds.insert(this); } @@ -101,7 +101,6 @@ RageSound::RageSound(const RageSound &cpy) full_buf = cpy.full_buf; big = cpy.big; - AutoStop = cpy.AutoStop; m_sFilePath = cpy.m_sFilePath; m_StartSeconds = cpy.m_StartSeconds; m_LengthSeconds = cpy.m_LengthSeconds; @@ -109,7 +108,9 @@ RageSound::RageSound(const RageSound &cpy) position = cpy.position; playing = false; speed = cpy.speed; - + AccurateSync = cpy.AccurateSync; + AutoStop = cpy.AutoStop; + if(big) { /* We can't copy the Sound_Sample, so load a new one. @@ -560,7 +561,10 @@ void RageSound::SetPositionSeconds( float fSeconds ) if(big) { ASSERT(stream.Sample); - Sound_AccurateSeek(stream.Sample, int(fSeconds * 1000)); + if(AccurateSync) + Sound_AccurateSeek(stream.Sample, int(fSeconds * 1000)); + else + Sound_FastSeek(stream.Sample, int(fSeconds * 1000)); stream.buf.clear(); } } @@ -580,6 +584,9 @@ void RageSound::LoadAndPlayIfNotAlready( CString sSoundFilePath ) return; // do nothing Load( sSoundFilePath ); + SetPositionSeconds(0); + SetStartSeconds(0); + SetLengthSeconds(); SetLooping(); Play(); } diff --git a/stepmania/src/RageSound.h b/stepmania/src/RageSound.h index 58324cb95e..c3cac8be24 100644 --- a/stepmania/src/RageSound.h +++ b/stepmania/src/RageSound.h @@ -68,6 +68,8 @@ class RageSound float speed; + bool AccurateSync; + /* If true, the sound will stop when it reaches the end; otherwise it'll * continue to move forward, feeding silence, which is useful to continue * timing longer than the actual sound. (However, if this is false, the @@ -99,6 +101,7 @@ public: float GetLengthSeconds(); float GetPositionSeconds() const; void SetPositionSeconds( float fSeconds ); + void SetAccurateSync(bool yes=true) { AccurateSync = yes; } void SetPlaybackRate( float fScale ); float GetPlaybackRate() const { return speed; } bool IsPlaying() const { return playing; }