LMMS / lmms

Cross-platform music production software
https://lmms.io
GNU General Public License v2.0
7.8k stars 986 forks source link

Inconsistent clip rendering #6131

Open Spekular opened 2 years ago

Spekular commented 2 years ago

Bug Summary

Notes, waveforms, and automation nodes are not consistently rendered on the X axis.

Steps to reproduce

Create a clip containing alternating notes and rests of the same length. In the same way, create a sample clip with alternating sine/silence sections and a flipflopping automation clip. In the example this has been done with third and quarter notes. Sample clips were generated in Audacity with lengths of 3s and 4s, then imported at 20 BPM.

Expected behavior

Notes, samples, and automation clips all display their content at the same position and with the same same length, as they are synchronized.

Our bars are 16 pixels wide and 32 pixels tall at 100% zoom, with each bar encompassing the border to it's left. Thus, quarter notes should be 4 pixels wide, and their start points should be 0, 4, 8, and 12 pixels from the leftmost pixel of the bar. Note that borders must be ignored for positions to be correct relative to the timeline.

Actual behavior

Notes in note clips are rendered with correct starting points, but are 1 pixel too long (quarter notes are 5 rather than 4 pixels wide).

Conversely, lengths but not positions are correct in sample and automation clips. Contents are shifted to the right by two pixels (width of the clip border) compared to note clips and the playhead's position. Fixed in #6182.

These offsets appear to be absolute, as they are unchanged between 100% and 400% zoom.

Screenshot

100% Zoom

100% Zoom

400% Zoom image

Note playhead is precisely on bar start, but sample and automation clips' contents appear to start after current position. image

Affected LMMS versions

Reproduced in 1.3-Alpha.1, more thorough testing in 1.3-Alpha.2. Tested on Windows 10 with scale set to 100%, and DPI scaling handled by LMMS (Properties > Compatibility > Change high DPI settings > Override, scaling performed by application.)

Spekular commented 2 years ago

A related enhancement, IMO, would be to slim our borders down to 1px so they obscure less of the content. Mockup:

image

Spekular commented 2 years ago

Reopening since notes are still longer than they should be.

RoxasKH commented 2 years ago

A related enhancement, IMO, would be to slim our borders down to 1px so they obscure less of the content. Mockup:

image

I personally like this enhancement. It makes the patterns more flat and modern-looking, and as you said doesn't cover as much content as before.

M374LX commented 2 years ago

The fact is that PatternView::paintEvent() uses floating point numbers in the [0,1] range to draw notes, which makes it difficult to draw them with a precise length in pixels.