Skip to content

Commit 427f9f0

Browse files
committed
When adjusting the song position for duplicate positions being returned from the sound driver, multiply the time delta since last update by the rate. Whoa, stutter on rates is gone for DirectSound-sw!
1 parent f977755 commit 427f9f0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/GameState.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,9 +1250,15 @@ void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &ti
12501250
/* It's not uncommon to get a lot of duplicated positions from the sound
12511251
* driver, like so: 13.120953,13.130975,13.130975,13.130975,13.140998,...
12521252
* This causes visual stuttering of the arrows. To compensate, keep a
1253-
* RageTimer since the last change. */
1254-
if(fPositionSeconds == m_LastPositionSeconds && !m_paused)
1255-
fPositionSeconds += m_LastPositionTimer.Ago();
1253+
* RageTimer since the last change and multiply the delta by the current
1254+
* rate when applied. */
1255+
if (fPositionSeconds == m_LastPositionSeconds && !m_paused)
1256+
{
1257+
//LOG->Info("Time unchanged, adding: %+f",
1258+
// m_LastPositionTimer.Ago()*m_SongOptions.GetSong().m_fMusicRate
1259+
//);
1260+
fPositionSeconds += m_LastPositionTimer.Ago()*m_SongOptions.GetSong().m_fMusicRate;
1261+
}
12561262
else
12571263
{
12581264
//LOG->Info("Time difference: %+f",

0 commit comments

Comments
 (0)