Let's not blink the transport time if we're in the Prepared state

This commit is contained in:
casey langen 2020-10-31 17:43:31 -07:00
parent ce4d9fe69d
commit b4c4ba1a9c

View File

@ -579,7 +579,7 @@ void TransportWindow::UpdateReplayGainState() {
void TransportWindow::Update(TimeMode timeMode) { void TransportWindow::Update(TimeMode timeMode) {
this->Clear(); this->Clear();
size_t cx = (size_t) this->GetContentWidth(); size_t const cx = (size_t) this->GetContentWidth();
if (cx < MIN_WIDTH || this->GetContentHeight() < MIN_HEIGHT) { if (cx < MIN_WIDTH || this->GetContentHeight() < MIN_HEIGHT) {
return; return;
@ -591,15 +591,17 @@ void TransportWindow::Update(TimeMode timeMode) {
return; return;
} }
auto state = transport.GetPlaybackState(); auto const state = transport.GetPlaybackState();
bool paused = (state == PlaybackPrepared || state == PlaybackPaused); bool const paused = state == PlaybackPaused;
bool stopped = (state == PlaybackStopped); bool const prepared = state == PlaybackPrepared;
bool muted = transport.IsMuted(); bool const stopped = state == PlaybackStopped;
bool replayGainEnabled = (this->replayGainMode != ReplayGainMode::Disabled); bool const muted = transport.IsMuted();
bool const replayGainEnabled = (this->replayGainMode != ReplayGainMode::Disabled);
Color const gb = Color::TextActive;
Color const disabled = Color::TextDisabled;
Color const bright = Color::TextDefault;
Color gb = Color::TextActive;
Color disabled = Color::TextDisabled;
Color bright = Color::TextDefault;
Color volumeAttrs = Color::Default; Color volumeAttrs = Color::Default;
if (this->focus == FocusVolume) { if (this->focus == FocusVolume) {
@ -687,7 +689,7 @@ void TransportWindow::Update(TimeMode timeMode) {
Color currentTimeAttrs = timerAttrs; Color currentTimeAttrs = timerAttrs;
if (paused) { /* blink the track if paused */ if (paused) { /* blink the track if paused */
int64_t now = duration_cast<seconds>( int64_t const now = duration_cast<seconds>(
system_clock::now().time_since_epoch()).count(); system_clock::now().time_since_epoch()).count();
if (now % 2 == 0) { if (now % 2 == 0) {
@ -706,7 +708,7 @@ void TransportWindow::Update(TimeMode timeMode) {
double smoothedTime = this->lastTime += 1.0f; /* 1000 millis */ double smoothedTime = this->lastTime += 1.0f; /* 1000 millis */
double actualTime = playback.GetPosition(); double actualTime = playback.GetPosition();
if (paused || stopped || fabs(smoothedTime - actualTime) > TIME_SLOP) { if (prepared || paused || stopped || fabs(smoothedTime - actualTime) > TIME_SLOP) {
smoothedTime = actualTime; smoothedTime = actualTime;
} }