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

Consistently use seconds instead of milliseconds throughout playback module #23794

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

cbjeukendrup
Copy link
Contributor

Resolves: #23793

The time input field in the playback toolbar was not working properly, because the amount of milliseconds resulting from the entered time was accidentally interpreted as a number of ticks, because the wrong overload of seek was used. This problem is avoided by eliminating the usage of the msecs_t type completely.

Will conflict with #19038; it doesn't really matter which one is merged first.

@DmitryArefiev
Copy link
Contributor

@cbjeukendrup Tested on Win10. There is a regression comparing with master (and 4.3.2)

  1. Playback position slider doesn't move smoothly during playback
  2. When dragging playback position slider during playback, it plays all notes
bandicam.2024-07-29.15-59-43-313.mp4

@cbjeukendrup cbjeukendrup force-pushed the playbackcontroller_msecs branch from 5c955eb to b465fde Compare July 29, 2024 20:40
@cbjeukendrup
Copy link
Contributor Author

@DmitryArefiev Oops, there was one letter I forgot to remove 😄 But now it should be better!

@DmitryArefiev
Copy link
Contributor

@cbjeukendrup All fine now.

But I found another bug with measure counter in the playback panel (also regression from 4.3.2). Do you want to fix in this PR? :)

Just try to input 123 (in big score):

bandicam.2024-07-30.17-19-21-822.mp4

…module

Resolves musescore#23793: the time input field in the playback toolbar was not working properly, because the amount of milliseconds resulting from the entered time was accidentally interpreted as a number of ticks, because the wrong overload of `seek` was used. This problem is avoided by eliminating the usage of the msecs_t type completely.
@cbjeukendrup cbjeukendrup force-pushed the playbackcontroller_msecs branch from b465fde to 30d34af Compare July 30, 2024 18:00
@cbjeukendrup
Copy link
Contributor Author

@DmitryArefiev I found a fix for that too! @RomanPudashkin please check if it looks good :)

PlaybackToolbarModel emitted a "playback position changed" signal in response to notifications on the `playbackState->playbackPositionChanged()` channel. `PlaybackController` also listens to this channel, and uses it to update its `m_currentTick` value. The value is used to determine the current measure/beat position in PlaybackToolbar.

The problem: the order in which channel listeners are invoked is undefined. And in this case we are unlucky: PlaybackToolbarModel's listener is invoked first, so it updates the QML view; and only after that, PlaybackController's listener is invoked, so its `m_currentTick` is updated too late. So, the QML view is updated based on the old `m_currentTick`.

Solution: don't listen to `playbackState->playbackPositionChanged()` directly, but listen to a channel from PlaybackController. This channel sends the notification after updating `m_currentTick`.

This commit also updates the name and signature of this channel, to better reflect its purpose.

This problem was a regression, maybe caused by 8b95896, but that is an unverified conjecture.
@cbjeukendrup cbjeukendrup force-pushed the playbackcontroller_msecs branch from 30d34af to 2f7f138 Compare July 30, 2024 18:58
@DmitryArefiev
Copy link
Contributor

@cbjeukendrup Yeah, all fixed!

Tested #23793 on Win10, Mac13.6, LinuxUbuntu22.04 - FIXED

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.

When entering a time code in the playback toolbar, it jumps to a different time than what you enter
3 participants