~mendomusic/lmms/+git/lmms-github:groove

Last commit made on 2024-04-16
Get this branch:
git clone -b groove https://git.launchpad.net/~mendomusic/lmms/+git/lmms-github

Branch merges

Branch information

Name:
groove
Repository:
lp:~mendomusic/lmms/+git/lmms-github

Recent commits

013aef5... by Hyunjin Song

Remove connections to a nonexistent signal

cbcde94... by Hyunjin Song

Merge branch 'master' into groove

d2c2a80... by Michael Gregorius <email address hidden>

Update CMT submodule / Upgrade code for CMT delays (#7206)

## Bump CMT to d8bf8084aa3
Bump the CMT submodule to commit d8bf8084aa3 which contains the underlying fixes for issue #5167.

The CMT delay uses `sprintf` calls to generate the technical names and display names of the delays. These calls are locale dependent. As a consequence for example the feedback delay might have been saved either as "fbdelay_0.1s" (point) or "fbdelay_0,1s" (comma) in a save file.

The CMT fix makes sure that all delays use points in their names and thus that they now always report the same name strings.

## Add upgrade routine for CMT delays
Add an upgrade routine for CMT delays which works in conjunction with the upgraded CMT submodule. Because the delays will now always report their name with points old save files which might contain versions with the comma must be upgraded to a name with a point.

d3ab315... by Dominic Clark <email address hidden>

Support VSTs on Linux even if Wine is unavailable (#7205)

815f88d... by Michael Gregorius <email address hidden>

Scalable LFO graph (#7203)

## Scalable LFO graph
Make the rendering of the LFO graph scalable. Change the fixed size to a minimum size. Adjust the rendering code such that it uses the width and height of the widget instead of the background pixmap.

Only draw only poly line once instead of many line segments. Collect the points in the for-loop to be able to do so. This makes the code a bit more understandable because we now compute exacly one point per iteration in the for-loop.

Use the same interpolation for the line color like in the envelope graph.

Rename some variables to make them consistent with the other code.

Remove the member `m_params` which is not used anyway. This also allows for the removal of the overridden `modelChanged` method.

## Use "Hz" instead of "ms/LFO"
Use the more common unit "Hz" to display the frequency of the LFO instead of "ms/LFO". The frequency is always displayed with three digits after the decimal separator to prevent "jumps".

## Take "Freq * 100" into account
This commit fixes a bug where the "Freq * 100" option was not taken into account when computing and displaying the frequency of the LFO.

## Keep info text legible
Draw a slightly transparent black rectangle underneath the text to keep it legible, e.g. for high frequencies with an LFO amount of 1 which results in a very bright and dense graph.

## Extract drawing of info text into method
Extract the drawing of the info text into its own private method `drawInfoText`.

8e40038... by Michael Gregorius <email address hidden>

Scalable envelope graph (#7194)

Make the graph scalable by adjusting the painting code of the envelope so that it does not assume fixed widths and heights anymore. Remove the setting of a fixed size from the envelope graph and only set a minimum size.

Make three scaling modes available which can be selected via a context menu in the graph:
* "Dynamic": This modes corresponds to the rendering strategy of the previous implementation. Initially 80/182 of the available width is used as the maximum width per segment. This can be interpreted like a "zoomed" version of the absolute mode. If the needed space becomes larger than the full width though then it falls back to relative rendering.
* "Absolute": Each of the five segments is assigned 1/5 of the available width. The envelopes will always fit but might appear small depending of the current settings. This is a good mode to compare envelopes though.
* "Relative": If there is at least one non-zero segment then the whole width is always used to present the envelope.

The default scaling mode is "Dynamic".

## Technical details

The new painting code is more or less divided into two parts. The first part calculates `QPointF` instances for the different points. In the second part these points are then used to draw the lines and markers. This makes the actual rendering code much more straight forward, readable and maintainable.

The interpolation between the line color of an inactive and an active envelope has also been restructured so that it is much more obvious that we are doing an interpolation in the first place. The colors at both ends of the interpolation are explicit now and can therefore be adjusted much easier. The actual color interpolation is done in the helper function `interpolateInRgb` which is provided by the new class `ColorHelper`. This class will later also be needed when the LFO graph is made scalable.

The line is rendered as a polyline instead of single line segments.

The drawing of the markers has been abstracted into a lambda (with some outside captures though) so that it can be easily adjusted if necessary. The markers are rendered as circles instead of rectangles because that looks much nicer especially when the widget is rendered at a larger size.

The width of the lines and marker outlines is determined using the size of the widget so that it scales with the size.

A `lerp` function has been added to `lmms_math.h`.

1f5f28f... by Levin Oehlmann

Don't auto-quantize notes when recording MIDI input (#6714)

* Don't auto-quantize notes when recording MIDI input.

* Add midi:autoquantize to config file and a widget to set it in the MIDI settings.

* Quantize notes during recording if midi:autoquantize is enabled.

* Apply suggestions from code review: Formatting

Style formatting

Co-authored-by: saker <email address hidden>

* Cache the auto quantization setting in a PianoRoll member variable, and update it on ConfigManager::valueChanged()

* Apply suggestions from code review: Formatting & temp variable

One formatting change, and reusing an existing variable instead of introducting a new local one.

Co-authored-by: saker <email address hidden>
Co-authored-by: IanCaio <email address hidden>

* Update src/gui/modals/SetupDialog.cpp

Good catch.

Co-authored-by: IanCaio <email address hidden>

* Fix logic bug in PianoRoll's midi/autoquantize value observer.

* Use '!' instead of 'not' to please MSVC.

* autoquantize: Add an explicit check for consistency with the rest of the PR, and give the setting a default value in SetupDialog constructor.

* Integrate MIDI auto-quantize checkbox into the resizable layout, and add a tool tip.

---------

Co-authored-by: saker <email address hidden>
Co-authored-by: IanCaio <email address hidden>

2472e9e... by Michael Gregorius <email address hidden>

GUI adjustments around base velocity (#7196)

Change the label of the group box from "CUSTOM BASE VELOCITY" to "VELOCITY MAPPING".

Remove the long explanation text from the group box and add the following tool tip for the LcdSpinBox: "MIDI notes at this velocity correspond to 100% note velocity."

Change the label of the spin box from "BASE VELOCITY" to "MIDI VELOCITY" because that's what the value actually represents.

922eb7f... by Michael Gregorius <email address hidden>

Fix NaNs for some dbFS value displays (-∞ dbFS) (#7142)

Fix some NaNs in the context of the display of dbFS values when "View > Volume as dbFS" is checked. They occur during the display of the current value when a mixer fader or the volume knob of an instrument is pulled down completely.

The fix is to detect these cases and to display "-∞ dbFS".

Also fix a problem with the editor where dbFS values can be entered for volume knobs. When the knob is turned completely to the left and the amplification is 0 then the initially displayed value is set to -96 dBFS, i.e. the lower limit that is shown in the dialog. This is done because the dialog likely cannot handle displaying or entering "-∞".

ba4fda7... by Michael Gregorius <email address hidden>

Scalable consistent faders with themeable gradients, marker at unity, dbFS by default (#7045)

* Render fader levels in code with a gradient

Render the fader level in code using a gradient instead of using pixmaps. The problem with the pixmaps is that they don't "know" how a fader instance is configured with regards to the minimum and maximum value. This means that the display can give quite a wrong impression.

The rendering of levels has been unified in the method `paintLevels`. It can render using dbFS and linear scale. The method `paintLinearLevels` has been removed completely, i.e. there's no more code that renders using pixmaps.

Much of the previous code relied on the size of the background image `fader_background.png`, e.g. the initialization of the size. For now the `Fader` widget is initially resized to the size of that background image as it is present in the default and classic theme (see `Fader::init`). All rendering uses the size of the widget itself to determine where to draw what. This means that the widget is prepared to be resizable.

The method `paintLevels` first renders the background of the level indicators and uses these as clipping paths for all other rendering operations, e.g. for the rendering of the levels themselves. Levels are rendered using a gradient which is defined with the following stops:
* Two stops for the ok levels.
* One stop for warning levels.
* One stop for clipping levels.

Peak indicators do not use the three distinct colors anymore but instead use the color of the gradient at that position of the peak. This makes everything look "smooth".

The code now also renders a marker at unity position, i.e. at position 1.0 in linear levels and 0 dbFS in dbFS scale.

The painting code makes lots of use of the class `PaintHelper`. This class is configured with a minimum and maximum value and can then return linear factors for given values. There are two supported modes:
* Map min to 0 and max to 1
* Map min to 1 and max to 0

It can also compute rectangles that correspond to a given value. These methods can be given rectangles that are supposed to represent the span from min to max. The returned result is then a rectangle that fills the lower part of the source rectangle according to the given value with regards to min and max (`getMeterRect`). Another method returns a rectangle of height 1 which lies inside the given source rectangle at the corresponding level (`getPersistentPeakRect`).

The method `paintLevels` uses a mapping function to map the amplitude values (current peak value, persistent peak, etc.) to the display values. There's one mapper that keeps the original value and it is used to display everything in a linear scale. Another mapper maps everything to dbFS and uses these values as display everything in a dbFS scale. The following values must be mapped for the left and right channel to make this work:
* Min and max display values (min and max peak values)
* The current peak value
* The persistent peak value
* The value for unity, i.e. 1.0 in linear levels and 0 dbFS in dbFS scale.

Remove the method `calculateDisplayPeak` which was used in the old method to render linear levels.

`Fader::setPeak` now uses `std::clamp` instead of doing "manual" comparisons.

The LMMS plugins Compressor, EQ and Delay are still configured to use linear displays. It should be considered to switch them to dbFS/logarithmic displays as well and to remove the code that renders linearly.

* Remove unused pixmaps from `Fader`

Remove the now unused pixmaps for the background and the LEDs from the `Fader` class and remove the files from the default and classic theme directories.

* Rename peak properties and use them to render levels

Rename the peak properties as follows:
* peakGreen -> peakOk
* peakRed -> peakClip
* peakYellow -> peakWarn

The reasoning is that a style might for example use a different color than green to indicate levels that are ok.

Use the properties to initialize the gradient that is used to render the levels.

Initialize the properties to the colors of the current default theme so that it's not mandatory to set them in a style sheet. Up until now they have all been initialized as black.

* Always render the knob in the middle of the fader

Render the knob in the middle of the fader regardless of the width. The previous implementation was dependent on the fader pixmap having a matching width because it always rendered at x=0.

* Set size policy of fader to minimum expanding

Set the size policy of the fader to minimum expanding in both directions. This will make the fader grow in layouts if there is space.

* Default dbFS levels and better peak values

Default to dbFS levels for all faders and set some better minimum and maximum peak values.

* Fix faders of Crossover EQ

Fix the faders of the Crossover EQ which were initialized and rendered much too wide and with a line at unity. The large width also resulted in the knobs being rendered outside of view.

Resize the fader to the minimum size so that it is constructed at a sane default.

Introduce a property that allows to control if the unity line is rendered. The property is available in style sheets and defaults to the unity lines being rendered. Adjust the paint code to evaluate the property.

Initialize the faders of the Crossover EQ such that the unity line is not drawn.

* Remove EqFader constructor with pixmaps

Remove the constructor of `EqFader` that takes the pixmaps to the fader background, leds and knob. The background and leds pixmaps are not used by the base class `Fader` for rendering anymore to make the `Fader` resizable. A pixmap is still used to render the knob but the constructor that takes the knob as an argument does not do anything meaningful with it, i.e. all faders are rendered with the default knob anyway.

Remove the resources for the fader background, leds and knob as they are not used and the knob was the same image as the default knob anyway.

Remove the static pixmaps from the constructor of `EqControlsDialog`. Switch the instantiations of the EQ's faders to use the remaining constructor of `EqFader`. This constructor sets a different fixed size of (23, 116) compared to the removed constructor which set a size of (23, 80). Therefore all faders that used the removed constructor are now set explicitly to a fixed size of (23, 80).

The constructor that's now used also calls a different base constructor than the removed one. The difference between the two base constructors of `Fader` is that one of them sets the member `m_conversionFactor` to 100.0 whereas the other one keeps the default of 1.0. The adjusted faders in `EqControlsDialog` are thus now constructed with the conversion factor set to 100. However, all of them already call `setDisplayConversion` with `false` after construction which results in the conversion factor being reset to 1.0. So the result should be the same as before the changes.

* Remove background and LEDs pixmap from Fader constructor

Remove the parameters for the background and LEDs pixmap from the second `Fader` constructor. Make the knob pixmap parameter in the constructor a const reference. Assign the reference to the knob pixmap of the `Fader` itself. This enables clients to use their own fader knobs as is the case with the Crossover EQ. The EQ now renders using it's own knobs again.

Make the second constructor delegate to the first one. This will additionally set the conversion factor to 100 but this is not a problem with the current code because the only user of the second constructor, the Crossover EQ, already calls `setDisplayConversion` with the parameter set to `false`, hence reinstating a conversion factor of 1.

Remove the resources for the background and LEDs from the Crossover EQ as they are not used anymore. Remove the three QPixmap members from `CrossoverEQControlDialog` as they are not needed. The background and LEDs are not used anyway and the knob is passed in as a constant reference which is copied. Hence we can use a local variable in the constructor of `CrossoverEQControlDialog`.

* Remove the init method from Fader

Remove the `init` method from `Fader` as it is not needed anymore due to the constructor delegation. Tidy up the parameter lists and use of spaces in the constructor.

* Introduce range with solid warn color

Introduce a second point in the gradient for the warn colors so that we get a certain range with the full/solid warn color.

The colors are distributed as follows now. The solid ok range goes from -inf dbFS to -12 dbFS. The warn range goes from -6 dbFS to 0 dbFS. In between the colors are interpolated. Values above 0 dbFS interpolate from the warn color to the clip color.

This is now quite similar to the previous implementation.

# Analysis of the previous pixmap implementation
The pixmap implementation used pixmaps with a height of 116 pixels to map 51 dbFS (-42 dbFS to 9 dbFS) across the whole height. The pixels of the LED pixmap were distributed as follows along the Y-axis:
* Margin: 4
* Red: 18
* Yellow: 14
* Green: 76
* Margin: 4

Due to the margins the actual red, yellow and green areas only represent a range of (1 - (4+4) / 116) * 51 ~ 47,48 dbFS. This range is distributed as follows across the colors:
Red: 7.91 dbFS
Yellow: 6.16 dbFS
Green: 33.41 dbFS

The borders between the colors are located along the following dbFS values:
* Red/yellow: 9 - (4 + 18) / 116 * 51 dbFS ~ -0.67 dbFS
* Yellow/green: 9 - (4 + 18 + 14) / 116 * 51 dbFS ~ -6.83 dbFS
* The green marker is rendered for values above -40.24 dbFS.

* Remove unused method Fader::clips

* Fader: Correctly render arbitrary ranges

Adjust the `Fader` so that it can correctly render arbitrary ranges of min and max peak values, e.g. that it would render a display range of [-12 dbFS, -42 dbFS] correctly.

Until now the gradient was defined to start at the top of the levels rectangle and end at the bottom. As a result the top was always rendered in the "clip" color and the bottom in the "ok" color. However, this is wrong, e.g. if we configure the `Fader` with a max value of -12 dbFS and a min value of -42 dbFS. In that case the whole range of the fader should be rendered with the "ok" color.

The fix is to compute the correct window coordinates of the start and end point of gradient using from the "window" of values that the `Fader` displays and then to map the in-between colors accordingly. See the added comments in the code for more details.

Add the templated helper class `LinearMap` to `lmms_math.h`. The class defines a linear function/map which is initialized using two points. With the `map` function it is then possible to evaluate arbitrary X-coordinates.

* Remove unused methods in PaintHelper

Remove the now unused mapping methods from `PaintHelper`. Their functionality has been replaced with the usage of `LinearMap` in the code.

* Fix some builds

Include `cassert` for some builds that otherwise fail.

* Opaque unity marker with styling option

Make the unity marker opaque by default and enable to style it with the style sheets. None of the two style sheets uses this option though.

* Darker default color for the unity line

* Move code

Move the computation of most mapped values at the top right after the definition of the mapper so that it is readily available in all phases of the painting code.

* Render unity lines in background

Render the unity lines before rendering the levels so that they get overdrawn and do not stick out when they are crossed.

* Don't draw transparent white lines anymore

Don't draw the transparent white lines anymore as they were mostly clipped anyway and only create "smudge".

* Full on clip color at unity

Adjust the gradient so that the full on clip color shows starting at unity. There is only a very short transition from the end of warning to clipping making it look like a solid color "standing" on top of a gradient.

* Fix discrepancy between levels and unity markers

This commit removes the helper class `PaintHelper` and now uses two lambdas to compute the rectangles for the peak indicators and levels. It uses the linear map which maps the peak values (in dbFS or linear) to window coordinates of the widget.

The change fixes a discrepancy in the following implementation for which the full on clip rectangle rendered slightly below the unity marker.

* Fix fader display for Equalizer shelves and peaks

The peak values for the shelves and peaks of the Equalizer plugin are computed in `EqEffect::peakBand`. The previous implementation evaluated the bins of the corresponding frequency spectrum and determined the "loudest" one. The value of this bin was then converted to dbFS and mapped to the interval [0, inf[ where all values less or equal to -60 dbFS were mapped to 0 and a value of 40 dbFS was mapped to 1. So effectively everything was mapped somewhere into [0, 1] yet in a quite "distorted" way because a signal of 40 dbFS resulted in being displayed as unity in the fader.

This commit directly returns the value of the maximum bin, i.e. it does not map first to dbFS and then linearize the result anymore. This should work because the `Fader` class assumes a "linear" input signal and if the value of the bin was previously mapped to dbFS it should have some "linear" character. Please note that this is still somewhat of a "proxy" value because ideally the summed amplitude of all relevant bins in the frequency range would be shown and not just the "loudest" one.

## Other changes
Rename `peakBand` to `linearPeakBand` to make more clear that a linear value is returned.

Handle a potential division by zero by checking the value of `fft->getEnergy()` before using it.

Index into `fft->m_bands` so that no parallel incrementing of the pointer is needed. This also enables the removal of the local variable `b`.

* Improve the rendering of the levels

The levels rendering now more explicitly distinguished between the rendering of the level outline/border and the level meters. The level rectangles are "inset" with regards to the borders so that there is a margin between the level borders and the meter readings. This margin is now also applied to the top and bottom of the levels. Levels are now also rendered as rounded rectangles similar to the level borders.

Only render the levels and peaks if their values are greater than the minimum level.

Make the radius of the rounded rectangles more pronounced by increasing its value from 1 to 2.

Decrease the margins so that the level readings become wider, i.e. so that they are rendered with more pixels.

Add the lambda `computeLevelMarkerRect` so that the rendering of the level markers is more decoupled from the rendering of the peak markers.

* Reduce code repetition

Reduce code repetition in `EqEffect::setBandPeaks` by introducing a lambda. Adjust code formatting.

* Code review changes

Code review changes in `Fader.cpp`. Mostly whitespace adjustments.

Split up the calculation of the meter width to make it more understandable. This also reduces the number of parentheses.

* Use MEMBER instead of READ/WRITE

Use `MEMBER` instead of `READ`/`WRITE` for some properties that are not called explicitly from outside of the class.

* Use default member initializers for Fader

Use default member initializers for the members in `Fader` that have previously been initialized in the constructor list.

* Make code clearer

Make code clearer in `Fader::FadermouseDoubleClickEvent`. Only divide if the dialog was accepted with OK.