simplify and clarify
This commit is contained in:
@@ -484,6 +484,25 @@ void GameSoundManager::Update( float fDeltaTime )
|
|||||||
RageTimer tm;
|
RageTimer tm;
|
||||||
const float fSeconds = g_Playing->m_Music->GetPositionSeconds( &approximate, &tm );
|
const float fSeconds = g_Playing->m_Music->GetPositionSeconds( &approximate, &tm );
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check for song timing skips.
|
||||||
|
//
|
||||||
|
if( PREFSMAN->m_bLogSkips && !g_Playing->m_TimingDelayed )
|
||||||
|
{
|
||||||
|
const float fExpectedTimePassed = (tm - GAMESTATE->m_LastBeatUpdate) * g_Playing->m_Music->GetPlaybackRate();
|
||||||
|
const float fSoundTimePassed = fSeconds - GAMESTATE->m_fMusicSeconds;
|
||||||
|
const float fDiff = fExpectedTimePassed - fSoundTimePassed;
|
||||||
|
|
||||||
|
static CString sLastFile = "";
|
||||||
|
const CString ThisFile = g_Playing->m_Music->GetLoadedFilePath();
|
||||||
|
|
||||||
|
/* If fSoundTimePassed < 0, the sound has probably looped. */
|
||||||
|
if( sLastFile == ThisFile && fSoundTimePassed >= 0 && fabsf(fDiff) > 0.003f )
|
||||||
|
LOG->Trace("Song position skip in %s: expected %.3f, got %.3f (cur %f, prev %f) (%.3f difference)",
|
||||||
|
Basename(ThisFile).c_str(), fExpectedTimePassed, fSoundTimePassed, fSeconds, GAMESTATE->m_fMusicSeconds, fDiff );
|
||||||
|
sLastFile = ThisFile;
|
||||||
|
}
|
||||||
|
|
||||||
if( g_Playing->m_TimingDelayed )
|
if( g_Playing->m_TimingDelayed )
|
||||||
{
|
{
|
||||||
if( approximate )
|
if( approximate )
|
||||||
@@ -502,21 +521,6 @@ void GameSoundManager::Update( float fDeltaTime )
|
|||||||
g_Playing->m_TimingDelayed = false;
|
g_Playing->m_TimingDelayed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( PREFSMAN->m_bLogSkips )
|
|
||||||
{
|
|
||||||
const float fExpectedTimePassed = (tm - GAMESTATE->m_LastBeatUpdate) * g_Playing->m_Music->GetPlaybackRate();
|
|
||||||
const float fSoundTimePassed = fSeconds - GAMESTATE->m_fMusicSeconds;
|
|
||||||
const float fDiff = fExpectedTimePassed - fSoundTimePassed;
|
|
||||||
|
|
||||||
static CString sLastFile = "";
|
|
||||||
const CString ThisFile = g_Playing->m_Music->GetLoadedFilePath();
|
|
||||||
|
|
||||||
/* If fSoundTimePassed < 0, the sound has probably looped. */
|
|
||||||
if( sLastFile == ThisFile && fSoundTimePassed >= 0 && fabsf(fDiff) > 0.003f )
|
|
||||||
LOG->Trace("Song position skip in %s: expected %.3f, got %.3f (cur %f, prev %f) (%.3f difference)",
|
|
||||||
Basename(ThisFile).c_str(), fExpectedTimePassed, fSoundTimePassed, fSeconds, GAMESTATE->m_fMusicSeconds, fDiff );
|
|
||||||
sLastFile = ThisFile;
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECKPOINT_M( ssprintf("%f", fSeconds) );
|
CHECKPOINT_M( ssprintf("%f", fSeconds) );
|
||||||
GAMESTATE->UpdateSongPosition( fSeconds+fAdjust, g_Playing->m_Timing, tm+fAdjust );
|
GAMESTATE->UpdateSongPosition( fSeconds+fAdjust, g_Playing->m_Timing, tm+fAdjust );
|
||||||
|
|||||||
Reference in New Issue
Block a user