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

UI freezes when zooming to much in the song editor when there is a long sample track #7249

Closed
M4rotte opened this issue May 11, 2024 · 5 comments · Fixed by #7253
Closed
Labels

Comments

@M4rotte
Copy link

M4rotte commented May 11, 2024

System Information

Debian 12 - gcc 12.2.0 - QT5 5.15.8

LMMS Version(s)

LMMS 1.3.0-alpha.1.591+gb71d4f2aa

Most Recent Working Version

9ca9143

Bug Summary

Hi,

With a long sample track zooming-in too much freezes the UI.

After the sample is loaded (but before it freezes I have the following message):

qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 21390, resource id: 10657754, major code: 40 (TranslateCoords), minor code: 0

LMMS does not crash and I see two processes running at nearly 100% but the UI doesn’t respond anymore. If it happens during a playback the playback continues.

Expected Behaviour

UI not to freeze

Steps To Reproduce

Empty project.
Add sample track in the song editor with a quite long audio. In my case a mono 24bit/96kHz 00:35:03.43 long FLAC file (518Mo)
Zoom-in and zoom-out few times in the song editor (most of the times it happens when zooming-in too much)

@M4rotte M4rotte added the bug label May 11, 2024
@zonkmachine
Copy link
Member

Confirmed. Bisecting points to d5f5d00
@khoidauminh

d5f5d00a6f1faabdba4f710d04ad303bd439a6f2 is the first bad commit
commit d5f5d00a6f1faabdba4f710d04ad303bd439a6f2
Author: Pascal <[email protected]>
Date:   Thu May 2 07:13:55 2024 +0700

    Fix shifting of sample waveform during zoom (#7222)
    
    The original code was doing division in `int`, which causes lost of accuracy and results in the waveform randomly shifting when zooming in and out.
    
    This should fix it by casting variables to `float` before dividing, as well as keeping the values in `float` type.
    
    The pull request also changes some type declaration to explicit to increase readability

 src/gui/SampleWaveform.cpp | 57 +++++++++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 23 deletions(-)

@zonkmachine
Copy link
Member

For me the zoom action starts to get wonky and freeze on projects that are 10 minutes long, 5 minutes seem fine.

@khoidauminh
Copy link
Contributor

For me the zoom action starts to get wonky and freeze on projects that are 10 minutes long, 5 minutes seem fine.

Do you mean "wonky" as in the sample view gets drawn with garbled data or the UI lags? Both of these happen prior to the commit.

I've confirmed the issue to be an infinite loop, a pull request should be up soon

@zonkmachine
Copy link
Member

Do you mean "wonky" as in the sample view gets drawn with garbled data or the UI lags? Both of these happen prior to the commit.

I meant the UI lags (this issue). By sample drawn with garbled data you mean #3378 right?

@khoidauminh
Copy link
Contributor

khoidauminh commented May 16, 2024

Do you mean "wonky" as in the sample view gets drawn with garbled data or the UI lags? Both of these happen prior to the commit.

I meant the UI lags (this issue). By sample drawn with garbled data you mean #3378 right?

Yup

Regarding the UI lag, it's due to the function scanning the waveform every paint event and painting the entire Rect even if a large chunk of it is off-screen. 2 identical clips still gets painted independently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants