Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/gui/widgets/TimeDisplayWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ TimeDisplayWidget::TimeDisplayWidget() :

connect( getGUI()->mainWindow(), SIGNAL(periodicUpdate()),
this, SLOT(updateTime()));

// positionJumped fires when the user moves the playhead while paused;
// periodicUpdate() alone would lag by up to one timer tick in that case.
connect(&Engine::getSong()->getTimeline(Song::PlayMode::None),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is only a connection made to the Song::PlayMode::None timeline, but none of the other timelines?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When the transport is stopped (not playing), m_playMode is always PlayMode::None. The Home key handler calls setTicks(0) on all timelines, but TimeDisplayWidget::updateTime() reads its position value exclusively from PlayMode::None's timeline — that's the one that drives the display whenever playback isn't active.

Connecting only PlayMode::None's positionJumped is therefore sufficient: it's the only timeline whose value is actually shown, and because it fires after all timelines have been updated it reads the correct (already-zeroed) position. Connecting all five timelines would trigger five redundant updateTime() calls per keypress with no benefit.

&Timeline::positionJumped, this, &TimeDisplayWidget::updateTime);
}

void TimeDisplayWidget::setDisplayMode( DisplayMode displayMode )
Expand Down