Skip to content

Commit

Permalink
Fix some sync issues with seeking and pausing in Practice
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Nov 1, 2019
1 parent a89ebd6 commit 4180ff7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Etterna/Screen/Gameplay/ScreenGameplayPractice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ ScreenGameplayPractice::TogglePause()
GetMusicEndTiming(fSecondsToStartFadingOutMusic,
fSecondsToStartTransitioningOut);

RageSoundParams p;
RageSoundParams p = m_pSoundMusic->GetParams();
p.m_StartSecond = fSeconds;
p.m_fSpeed = rate;
if (fSecondsToStartFadingOutMusic <
Expand All @@ -199,6 +199,7 @@ ScreenGameplayPractice::TogglePause()
MUSIC_FADE_OUT_SECONDS - p.m_StartSecond;
}
p.StopMode = RageSoundParams::M_CONTINUE;
p.m_bAccurateSync = true;
// Go
m_pSoundMusic->Play(false, &p);
} else {
Expand All @@ -211,10 +212,15 @@ void
ScreenGameplayPractice::SetSongPosition(float newSongPositionSeconds,
float noteDelay)
{
bool isPaused = GAMESTATE->GetPaused();

RageSoundParams p = m_pSoundMusic->GetParams();
p.m_bAccurateSync = !isPaused;
m_pSoundMusic->SetParams(p);

SOUND->SetSoundPosition(m_pSoundMusic, newSongPositionSeconds - noteDelay);
UpdateSongPosition(0);

bool isPaused = GAMESTATE->GetPaused();
m_pSoundMusic->Pause(isPaused);

Steps* pSteps = GAMESTATE->m_pCurSteps;
Expand Down Expand Up @@ -295,6 +301,7 @@ ScreenGameplayPractice::AddToRate(float amountAdded)
MUSIC_FADE_OUT_SECONDS - p.m_StartSecond;
}
p.StopMode = RageSoundParams::M_CONTINUE;
p.m_bAccurateSync = true;
// Go
m_pSoundMusic->Play(false, &p);
// But only for like 1 frame if we are paused
Expand Down

0 comments on commit 4180ff7

Please sign in to comment.