diff --git a/src/GameSoundManager.cpp b/src/GameSoundManager.cpp index 6ebb315bd6..fb9ee7cefb 100644 --- a/src/GameSoundManager.cpp +++ b/src/GameSoundManager.cpp @@ -601,12 +601,10 @@ void GameSoundManager::Update( float fDeltaTime ) } /* There's a delay between us calling Play() and the sound actually playing. - * During this time, m_bApproximate will be true. Keep using the previous timing - * data until we get a non-approximate time, indicating that the sound has actually - * started playing. */ - bool m_bApproximate; + * Keep using the previous timing data until we get a non-approximate time, + * indicating that the sound has actually started playing. */ RageTimer tm; - const float fSeconds = g_Playing->m_Music->GetPositionSeconds( &m_bApproximate, &tm ); + const float fSeconds = g_Playing->m_Music->GetPositionSeconds( &tm ); // Check for song timing skips. if( PREFSMAN->m_bLogSkips && !g_Playing->m_bTimingDelayed ) @@ -627,7 +625,7 @@ void GameSoundManager::Update( float fDeltaTime ) // If g_Playing->m_bTimingDelayed, we're waiting for the new music to actually start // playing. - if( g_Playing->m_bTimingDelayed && !m_bApproximate ) + if( g_Playing->m_bTimingDelayed ) { /* Load up the new timing data. */ g_Playing->m_Timing = g_Playing->m_NewTiming; diff --git a/src/RageSound.cpp b/src/RageSound.cpp index c7c602357f..1c3bd07d98 100644 --- a/src/RageSound.cpp +++ b/src/RageSound.cpp @@ -473,16 +473,13 @@ float RageSound::GetLengthSeconds() return iLength / 1000.f; // ms -> secs } -int RageSound::GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame, bool *bApproximate ) const +int RageSound::GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame ) const { if( m_HardwareToStreamMap.IsEmpty() || m_StreamToSourceMap.IsEmpty() ) return 0; - // TODO(sukibaby): The nullptrs passed to the functions below are part of a gradual - // procedure to remove bApproximate from the code base. Until it's fully removed, - // this will remain nullptr for now. In the future, these nullptr's should be removed. - std::int64_t iStreamFrame = m_HardwareToStreamMap.Search( iHardwareFrame, nullptr ); - return static_cast(m_StreamToSourceMap.Search( iStreamFrame, nullptr )); + std::int64_t iStreamFrame = m_HardwareToStreamMap.Search( iHardwareFrame ); + return static_cast(m_StreamToSourceMap.Search( iStreamFrame )); } /* If non-nullptr, approximate is set to true if the returned time is approximated because of @@ -492,7 +489,7 @@ int RageSound::GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame, boo * position. We might take a variable amount of time before grabbing the timestamp (to * lock SOUNDMAN); we might lose the scheduler after grabbing it, when releasing SOUNDMAN. */ -float RageSound::GetPositionSeconds( bool *bApproximate, RageTimer *pTimestamp ) const +float RageSound::GetPositionSeconds( RageTimer *pTimestamp ) const { // Get our current hardware position. std::int64_t iCurrentHardwareFrame = SOUNDMAN->GetPosition(pTimestamp); @@ -514,7 +511,7 @@ float RageSound::GetPositionSeconds( bool *bApproximate, RageTimer *pTimestamp ) return static_cast(m_iStoppedSourceFrame) / fSampleRate; } - int iSourceFrame = GetSourceFrameFromHardwareFrame( iCurrentHardwareFrame, bApproximate ); + int iSourceFrame = GetSourceFrameFromHardwareFrame( iCurrentHardwareFrame ); return static_cast(iSourceFrame) / fSampleRate; } diff --git a/src/RageSound.h b/src/RageSound.h index beaa33824c..164d5f8505 100644 --- a/src/RageSound.h +++ b/src/RageSound.h @@ -131,7 +131,7 @@ public: bool Pause( bool bPause ); float GetLengthSeconds(); - float GetPositionSeconds( bool *approximate=nullptr, RageTimer *Timestamp=nullptr ) const; + float GetPositionSeconds( RageTimer *Timestamp=nullptr ) const; RString GetLoadedFilePath() const { return m_sFilePath; } bool IsPlaying() const { return m_bPlaying; } @@ -175,7 +175,7 @@ private: RString m_sError; - int GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame, bool *bApproximate = nullptr ) const; + int GetSourceFrameFromHardwareFrame( std::int64_t iHardwareFrame ) const; bool SetPositionFrames( int frames = -1 ); RageSoundParams::StopMode_t GetStopMode() const; // resolves M_AUTO diff --git a/src/RageSoundPosMap.cpp b/src/RageSoundPosMap.cpp index 455d8ab227..3dc90bf130 100644 --- a/src/RageSoundPosMap.cpp +++ b/src/RageSoundPosMap.cpp @@ -108,7 +108,7 @@ void pos_map_impl::Cleanup() m_Queue.erase(m_Queue.begin(), it); } -std::int64_t pos_map_queue::Search( std::int64_t iSourceFrame, bool *bApproximate ) const +std::int64_t pos_map_queue::Search( std::int64_t iSourceFrame ) const { if( IsEmpty() ) { diff --git a/src/RageSoundPosMap.h b/src/RageSoundPosMap.h index 1e5b5effee..9bfedaf1cb 100644 --- a/src/RageSoundPosMap.h +++ b/src/RageSoundPosMap.h @@ -19,7 +19,7 @@ public: void Insert( std::int64_t iSourceFrame, std::int64_t iFrames, std::int64_t iDestFrame, double fSourceToDestRatio = 1.0 ); /* Return the iDestFrame for the given iSourceFrame. */ - std::int64_t Search( std::int64_t iSourceFrame, bool *bApproximate ) const; + std::int64_t Search( std::int64_t iSourceFrame ) const; /* Erase all mappings. */ void Clear(); diff --git a/src/RageTimer.cpp b/src/RageTimer.cpp index 63a555a29c..643aa6dfe7 100644 --- a/src/RageTimer.cpp +++ b/src/RageTimer.cpp @@ -35,11 +35,11 @@ const std::int64_t ONE_SECOND_IN_MICROSECONDS_LL = 1000000LL; const double ONE_SECOND_IN_MICROSECONDS_DBL = 1000000.0; const RageTimer RageZeroTimer(0,0); -static std::uint64_t g_iStartTime = ArchHooks::GetMicrosecondsSinceStart( true ); +static std::uint64_t g_iStartTime = ArchHooks::GetMicrosecondsSinceStart(); -static std::uint64_t GetTime( bool /* bAccurate */ ) +static std::uint64_t GetTime() { - return ArchHooks::GetMicrosecondsSinceStart( true ); + return ArchHooks::GetMicrosecondsSinceStart(); } /* The accuracy of RageTimer::GetTimeSinceStart() is directly tied to the @@ -50,21 +50,21 @@ static std::uint64_t GetTime( bool /* bAccurate */ ) * values truncated or rounded when they shouldn't be can cause errors when * this is calculated and manifest as a _sudden_ drift of sync. Use caution * and do thorough testing if you change anything here. -sukibaby */ -double RageTimer::GetTimeSinceStart(bool bAccurate) +double RageTimer::GetTimeSinceStart() { - std::uint64_t usecs = GetTime(bAccurate); + std::uint64_t usecs = GetTime(); usecs -= g_iStartTime; return usecs / ONE_SECOND_IN_MICROSECONDS_DBL; } std::uint64_t RageTimer::GetUsecsSinceStart() { - return GetTime(true) - g_iStartTime; + return GetTime() - g_iStartTime; } void RageTimer::Touch() { - std::uint64_t usecs = GetTime( true ); + std::uint64_t usecs = GetTime(); this->m_secs = std::uint64_t(usecs / ONE_SECOND_IN_MICROSECONDS_ULL); this->m_us = std::uint64_t(usecs % ONE_SECOND_IN_MICROSECONDS_ULL); diff --git a/src/RageTimer.h b/src/RageTimer.h index 76ad7f07bf..9c9ea0942b 100644 --- a/src/RageTimer.h +++ b/src/RageTimer.h @@ -23,8 +23,8 @@ public: /* (alias) */ float PeekDeltaTime() const { return Ago(); } - static double GetTimeSinceStart( bool bAccurate = true ); // seconds since the program was started - static float GetTimeSinceStartFast() { return GetTimeSinceStart(false); } + static double GetTimeSinceStart(); // seconds since the program was started + static float GetTimeSinceStartFast() { return GetTimeSinceStart(); } static std::uint64_t GetUsecsSinceStart(); /* Get a timer representing half of the time ago as this one. */ diff --git a/src/ScreenEdit.cpp b/src/ScreenEdit.cpp index 0f47a1b919..e8e6ee23dd 100644 --- a/src/ScreenEdit.cpp +++ b/src/ScreenEdit.cpp @@ -1660,7 +1660,7 @@ void ScreenEdit::Update( float fDeltaTime ) if( m_pSoundMusic->IsPlaying() ) { RageTimer tm; - const float fSeconds = m_pSoundMusic->GetPositionSeconds( nullptr, &tm ); + const float fSeconds = m_pSoundMusic->GetPositionSeconds( &tm ); GAMESTATE->UpdateSongPosition( fSeconds, GAMESTATE->m_pCurSong->m_SongTiming, tm ); } diff --git a/src/ScreenGameplay.cpp b/src/ScreenGameplay.cpp index 7d9b1900ca..149605ed1e 100644 --- a/src/ScreenGameplay.cpp +++ b/src/ScreenGameplay.cpp @@ -1583,7 +1583,7 @@ void ScreenGameplay::UpdateSongPosition( float fDeltaTime ) return; RageTimer tm; - const float fSeconds = m_pSoundMusic->GetPositionSeconds( nullptr, &tm ); + const float fSeconds = m_pSoundMusic->GetPositionSeconds( &tm ); const float fAdjust = SOUND->GetFrameTimingAdjustment( fDeltaTime ); GAMESTATE->UpdateSongPosition( fSeconds+fAdjust, GAMESTATE->m_pCurSong->m_SongTiming, tm+fAdjust ); } diff --git a/src/arch/ArchHooks/ArchHooks.h b/src/arch/ArchHooks/ArchHooks.h index 61d4913a41..341552a477 100644 --- a/src/arch/ArchHooks/ArchHooks.h +++ b/src/arch/ArchHooks/ArchHooks.h @@ -87,7 +87,7 @@ public: * underlying timers may be 32-bit, but implementations should try to avoid * wrapping if possible. */ - static std::int64_t GetMicrosecondsSinceStart( bool bAccurate ); + static std::int64_t GetMicrosecondsSinceStart(); /* * Add file search paths, higher priority first. diff --git a/src/arch/ArchHooks/ArchHooks_MacOSX.mm b/src/arch/ArchHooks/ArchHooks_MacOSX.mm index 89f52288eb..34e5093584 100644 --- a/src/arch/ArchHooks/ArchHooks_MacOSX.mm +++ b/src/arch/ArchHooks/ArchHooks_MacOSX.mm @@ -258,7 +258,7 @@ bool ArchHooks_MacOSX::GoToURL( RString sUrl ) return result == 0; } -std::int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate ) +std::int64_t ArchHooks::GetMicrosecondsSinceStart() { // http://developer.apple.com/qa/qa2004/qa1398.html static double factor = 0.0; diff --git a/src/arch/ArchHooks/ArchHooks_Unix.cpp b/src/arch/ArchHooks/ArchHooks_Unix.cpp index a580c1ae4a..ae2e4424eb 100644 --- a/src/arch/ArchHooks/ArchHooks_Unix.cpp +++ b/src/arch/ArchHooks/ArchHooks_Unix.cpp @@ -149,7 +149,7 @@ clockid_t ArchHooks_Unix::GetClock() return g_Clock; } -std::int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate ) +std::int64_t ArchHooks::GetMicrosecondsSinceStart() { OpenGetTime(); @@ -162,7 +162,7 @@ std::int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate ) return iRet; } #else -std::int64_t ArchHooks::GetMicrosecondsSinceStart( bool bAccurate ) +std::int64_t ArchHooks::GetMicrosecondsSinceStart() { struct timeval tv; gettimeofday( &tv, nullptr ); diff --git a/src/arch/ArchHooks/ArchHooks_Win32Static.cpp b/src/arch/ArchHooks/ArchHooks_Win32Static.cpp index c59e6398fc..c21e63fed4 100644 --- a/src/arch/ArchHooks/ArchHooks_Win32Static.cpp +++ b/src/arch/ArchHooks/ArchHooks_Win32Static.cpp @@ -39,7 +39,7 @@ static void InitTimer() QueryPerformanceFrequency(&g_liFrequency); } -std::int64_t ArchHooks::GetMicrosecondsSinceStart(bool bAccurate) +std::int64_t ArchHooks::GetMicrosecondsSinceStart() { // Make sure the timer is initialized. if (!g_bTimerInitialized) {