Skip to content
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

Fix #16519: L/R Arrow During Playback Moves From Playhead Current Location #19038

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

22justinl
Copy link
Contributor

  • Left/Right Arrow: Move between beats
  • Left/Right Arrow + Ctrl/Command: Move between measures

Resolves: #16519

Changed so that left and right arrows during playback move the playback cursor instead of the selection (which causes the playback cursor to move back to the selection)

  • I signed the CLA
  • The title of the PR describes the problem it addresses
  • Each commit's message describes its purpose and effects, and references the issue it resolves
  • If changes are extensive, there is a sequence of easily reviewable commits
  • The code in the PR follows the coding rules
  • There are no unnecessary changes
  • The code compiles and runs on my machine, preferably after each commit individually
  • I created a unit test or vtest to verify the changes I made (if applicable)

@RomanPudashkin
Copy link
Contributor

@22justinl please rebase this PR. Thanks!

@zacjansheski
Copy link
Contributor

I think this change is problematic with repeats

Here is a video from the PR

video1399164880.mp4

@zacjansheski
Copy link
Contributor

Here is a video from current 4.2

video1231836572.mp4

@cbjeukendrup
Copy link
Contributor

cbjeukendrup commented Mar 31, 2024

@22justinl Kind reminder about the comments above :)
If you don't have time anymore to fix them, that's alright; in that case we'll close this PR, so that a different contributor can continue your work.
Please let us know!

@22justinl 22justinl force-pushed the move_playback_cursor_lr branch 3 times, most recently from c75a8b5 to 591151f Compare July 8, 2024 10:48
@22justinl 22justinl marked this pull request as draft July 8, 2024 11:04
@22justinl 22justinl force-pushed the move_playback_cursor_lr branch 2 times, most recently from d1bb114 to 2fadc4a Compare July 8, 2024 12:52
@22justinl 22justinl marked this pull request as ready for review July 8, 2024 13:41
@22justinl 22justinl force-pushed the move_playback_cursor_lr branch 2 times, most recently from d1f5e88 to ba0a45e Compare July 20, 2024 19:31
@@ -213,7 +213,7 @@ void PlaybackController::seek(const midi::tick_t tick)
return;
}

seek(tickToSecs(tick));
seek(playedTickToSecs(tick));
Copy link
Contributor

Choose a reason for hiding this comment

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

This method also looks very questionable; it's completely unclear whether it expects raw or played ticks. If you want, you could figure that out and include a fix in a separate commit, but that's absolutely not a must. Perhaps it's better to save that for a different PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would something like seekPlayedTick be fine?

Also, I made PlaybackController::seek public again (it was made private in #23011) but I'm now realizing I could instead keep it private and make a new public function (something like PlaybackController::seekBeat) to be called by NotationActionController::move. Would that be better?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not per se against making seek public (it can already be accessed anyway via the more cumbersome way of calling dispatcher()->dispatch("rewind", ………)). But introducing a seekBeat method might be even better indeed. Perhaps it's nice to put it just below seekElement.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would something like seekPlayedTick be fine?

Judging from how m_currentTicks is used, it looks like that is actually raw ticks. So I would assume this method is rather seekRawTick, and thus should use rawTickToSecs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hm, wouldn't it be played ticks since, for example, PlaybackController::seekElement uses a value from NotationPlayback::playPositionTickByElement, which returns played ticks?

Copy link
Contributor

Choose a reason for hiding this comment

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

I researched it a bit more, and found a bug which I logged as #23795.

m_currentTicks is indeed a raw tick, but this function works with played ticks. However, it turns out that in all cases where this function is called, the value that will become the argument of this function is a raw tick, but it is then converted to a played tick before calling the function.

So, the solution would be to make this function receive raw ticks, and adjust the callers to remove the conversion to played ticks.

There should be exactly three callers: seekElement, seekListSelection, and setTempoMultiplier.
In the current master branch, there is a fourth one though: rewind. It tries to pass milliseconds, instead of seconds or ticks. There is no overload for milliseconds, so this (wrongly) uses the ticks overload. However, you don't need to worry about this, because I fixed it in #23794.

…from playback cursor location

- left/right arrow: move between beats
- left/right arrow + ctrl/command: move between measures
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

During playback, L/R arrow keys should move playback cursor instead of selection
4 participants