lmms icon indicating copy to clipboard operation
lmms copied to clipboard

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

Open M4rotte opened this issue 1 year ago • 3 comments

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

9ca9143f5b26ae0e0ab54dcecf5c81a3d4549d05

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 avatar May 11 '24 08:05 M4rotte

Confirmed. Bisecting points to d5f5d00a6f1faabdba4f710d04ad303bd439a6f2 @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 avatar May 11 '24 10:05 zonkmachine

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

zonkmachine avatar May 11 '24 11:05 zonkmachine

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

khoidauminh avatar May 12 '24 06:05 khoidauminh

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 https://github.com/LMMS/lmms/issues/3378 right?

zonkmachine avatar May 15 '24 20:05 zonkmachine

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

khoidauminh avatar May 16 '24 00:05 khoidauminh