-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Hitting Home in the Song-Editor or PianoRoll-Editor resets Time Display #8052
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
src/core/Song.cpp
Outdated
| getPlayPos(playMode).setTicks( ticks ); | ||
| getPlayPos(playMode).setCurrentFrame( 0.0f ); | ||
| getPlayPos(playMode).setJumped( true ); | ||
| setToTime(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this move the play pos to 0 no matter what ticks are passed to the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, you are right — fixed it.
…ction would break). Also fixed incorrect time information when navigating with left/right keys.
|
Compiled because of the lack of workloads. LGTM. |
| getPlayPos(playMode).setCurrentFrame( 0.0f ); | ||
| getPlayPos(playMode).setJumped( true ); | ||
| setToTime(0); | ||
| setToTimeByTicks(ticks); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
The TimeDisplayWidget retrieves the current song position using getMilliseconds() or playPos().
This time value is not reset to 0 when the Home key is pressed.
#7956