Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/core/Song.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ void Song::setPlayPos( tick_t ticks, PlayMode playMode )
getPlayPos(playMode).setTicks( ticks );
getPlayPos(playMode).setCurrentFrame( 0.0f );
getPlayPos(playMode).setJumped( true );
setToTimeByTicks(ticks);
Copy link
Member

Choose a reason for hiding this comment

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

I'm curious why you need to call setToTime/setToTimeByTicks at all, since the play pos is already set a few lines above. Looking at the definitions of those functions, I suppose because setToTime also forcefully sets the millisecond counter (rather than incrementing it as done above on line 610), that may prevent some issues?

Copy link
Author

Choose a reason for hiding this comment

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

The reason is that TimeDisplayWidget currently uses Song.getMilliseconds() in its updateTime() method.
getMilliseconds() is called without an explicit play mode (so the play mode is taken from the current song, which is set to NONE when stopped). But the position is set beforehand for the SONG play mode.

If I call setPlayPos() with the actual play mode instead of the fixed SONG mode, the indicator bar is not reset when pressing HOME.
So I guess this is the less invasive way to fix that bug.

Song::setPlayPos() is only invoked in the key event handler of SongEditor (left, right, home) and in clearProject(), so I assume it has no side effects.


// send a signal if playposition changes during playback
if( isPlaying() )
Expand Down
1 change: 1 addition & 0 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,7 @@ void PianoRoll::keyPressEvent(QKeyEvent* ke)
case Qt::Key_Home:
m_timeLine->pos().setTicks( 0 );
m_timeLine->updatePosition();
Engine::getSong()->setToTimeByTicks(0);
ke->accept();
break;

Expand Down
Loading