Starting playback with an off-screen cursor causes scroll to jump
#194 建立於 2021年7月9日
倉庫指標
- Star
- (6,921 star)
- PR 合併指標
- (30 天內沒有已合併 PR)
描述
- I have read the specified guidelines for issues
This is mostly quoted from my post at https://forum.audacityteam.org/viewtopic.php?f=46&t=104577, and previously reported at https://bugzilla.audacityteam.org/show_bug.cgi?id=2094. I can reproduce it
Describe the bug If the play-start point is off-screen, the display jumps twice every time you begin playback.
To Reproduce Steps to reproduce the behavior:
- Open an audio file.
- Change the zoom level so the audio track's width is 3x or more of the window's width.
- Click the track to set the "play start point" at least 1 screen away from the start of the audio file.
- Scroll so the "play start point" is just barely off-screen, to the left or right of the viewport.
- Press Space to play, again to stop. Rinse and repeat.
Results
Start playback with the "play start point" off-screen to the right
- [Start playback]
- The "current playback" cursor starts from the "play start point" and moves to the right.
- Some "initiate playback" UI lag occurs, then the UI becomes idle.
- The viewport does not move yet.
- [UI idle, "current playback" cursor off-screen to the right]
- Audacity scrolls the viewport rightwards so the "current playback" cursor is on the left of the screen, which takes time to redraw.
The behavior is fairly deterministic. The "play start" point is just barely off-screen (on the left), by a distance equal to the duration of ("initiate playback" UI lag).
Start playback with the "play start point" off-screen to the left
- [Start playback]
- Sometimes: [UI idle, "current playback" cursor off-screen to the left] (second event)
- Audacity scrolls the viewport leftwards so the cursor is on the right of the screen, which takes time to redraw.
- Afterwards, the play point has already moved off the screen (to the right). Trigger event [UI idle, "current playback" cursor off-screen to the right].
Why does the second event only happen sometimes? The "current playback" cursor starts from the "play start point" off-screen to the left, and moves to the right. If the "current playback" cursor goes on-screen before the UI lag ends, Audacity will not jitter. If the UI lag ends while the "current playback" cursor is still off-screen to the left], the second event will occur, and Audacity will scroll and redraw twice in succession.
If you (start playback with the "play start point" off-screen to the right), the viewport will move just past the cursor. If you then stop and play, there's around a 20% chance the second event will happen. If you move the viewport to the right so the "play start point" is far off-screen to the left, the second event is more likely to happen.
Once the second event happens, the "play start" point will be off-screen to the left by the same amount of time as the first redraw took (around 0.4 seconds in spectrogram mode, around 0.1 seconds in waveform mode). Since screen redrawing delay is longer than start-playback lag, every time you stop and play again, then the second event is pretty much guaranteed to recur.
Expected behavior
When you [Start playback]:
- If you start playback with the "play start point" off-screen to the left or right, the "play start position" (not current playback cursor) should scroll to the left of the viewport.
In case of [UI idle, "current playback" cursor off-screen to the left]:
- Unnecessary to change, but this could scroll the viewport leftwards so the cursor is on the left of the screen. But if users can scrub through the document towards the left (reverse playback), this is bad because it creates constant redraws.
As a result, initiating playback is no longer dependent on the whims of the "current playback" cursor, UI playback lag, and redraw lag.
An alternative is for playback to scroll the waveform smoothly while keeping the cursor centered.
Screenshots If applicable, add screenshots to help explain your problem.
https://user-images.githubusercontent.com/913957/125140056-8b4a9780-e0c6-11eb-8ae8-86691f53ae04.mp4
Additional information (please complete the following information):
- OS: Arch Linux
- Version: Git c3eaa8650d4d7800e6f92e50836add5acf16304f
- Sound Device ALSA outputting to PulseAudio
Additional context Add any other context about the problem here.