Removing bApproximate (part 2)
This should wrap up removing this flag from the code base.
This commit is contained in:
@@ -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;
|
||||
|
||||
+5
-8
@@ -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<int>(m_StreamToSourceMap.Search( iStreamFrame, nullptr ));
|
||||
std::int64_t iStreamFrame = m_HardwareToStreamMap.Search( iHardwareFrame );
|
||||
return static_cast<int>(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<float>(m_iStoppedSourceFrame) / fSampleRate;
|
||||
}
|
||||
|
||||
int iSourceFrame = GetSourceFrameFromHardwareFrame( iCurrentHardwareFrame, bApproximate );
|
||||
int iSourceFrame = GetSourceFrameFromHardwareFrame( iCurrentHardwareFrame );
|
||||
return static_cast<float>(iSourceFrame) / fSampleRate;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -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
|
||||
|
||||
@@ -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() )
|
||||
{
|
||||
|
||||
@@ -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();
|
||||
|
||||
+7
-7
@@ -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);
|
||||
|
||||
+2
-2
@@ -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. */
|
||||
|
||||
+1
-1
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user