Skip to content

Commit

Permalink
Scalable consistent faders with themeable gradients, marker at unity,…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
michaelgregorius authored Apr 5, 2024
1 parent d447cb0 commit ba4fda7
Show file tree
Hide file tree
Showing 22 changed files with 323 additions and 371 deletions.
Binary file removed data/themes/classic/fader_background.png
Binary file not shown.
Binary file removed data/themes/classic/fader_leds.png
Binary file not shown.
6 changes: 3 additions & 3 deletions data/themes/classic/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -653,9 +653,9 @@ lmms--gui--MixerChannelView QGraphicsView {

/* persistent peak markers for fx peak meters */
lmms--gui--Fader {
qproperty-peakGreen: rgb( 74, 253, 133);
qproperty-peakYellow: rgb(224, 222, 18);
qproperty-peakRed: rgb( 255, 100, 100);
qproperty-peakOk: rgb( 74, 253, 133);
qproperty-peakWarn: rgb(224, 222, 18);
qproperty-peakClip: rgb( 255, 100, 100);
}

lmms--gui--TimeLineWidget {
Expand Down
Binary file removed data/themes/default/fader_background.png
Binary file not shown.
Binary file removed data/themes/default/fader_leds.png
Binary file not shown.
6 changes: 3 additions & 3 deletions data/themes/default/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -694,9 +694,9 @@ lmms--gui--MixerChannelView QGraphicsView {

/* persistent peak markers for fx peak meters */
lmms--gui--Fader {
qproperty-peakGreen: #0ad45c;
qproperty-peakYellow: #d6ec52;
qproperty-peakRed: #c12038;
qproperty-peakOk: #0ad45c;
qproperty-peakWarn: #d6ec52;
qproperty-peakClip: #c12038;
}

lmms--gui--TimeLineWidget {
Expand Down
101 changes: 45 additions & 56 deletions include/Fader.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@

#include "AutomatableModelView.h"
#include "embed.h"
#include "lmms_math.h"


namespace lmms::gui
Expand All @@ -66,21 +67,21 @@ class LMMS_EXPORT Fader : public QWidget, public FloatModelView
{
Q_OBJECT
public:
Q_PROPERTY( QColor peakGreen READ peakGreen WRITE setPeakGreen )
Q_PROPERTY( QColor peakRed READ peakRed WRITE setPeakRed )
Q_PROPERTY( QColor peakYellow READ peakYellow WRITE setPeakYellow )
Q_PROPERTY( bool levelsDisplayedInDBFS READ getLevelsDisplayedInDBFS WRITE setLevelsDisplayedInDBFS )

Fader( FloatModel * _model, const QString & _name, QWidget * _parent );
Fader( FloatModel * _model, const QString & _name, QWidget * _parent, QPixmap * back, QPixmap * leds, QPixmap * knob );
Q_PROPERTY(QColor peakOk MEMBER m_peakOk)
Q_PROPERTY(QColor peakClip MEMBER m_peakClip)
Q_PROPERTY(QColor peakWarn MEMBER m_peakWarn)
Q_PROPERTY(bool levelsDisplayedInDBFS MEMBER m_levelsDisplayedInDBFS)
Q_PROPERTY(bool renderUnityLine READ getRenderUnityLine WRITE setRenderUnityLine)
Q_PROPERTY(QColor unityMarker MEMBER m_unityMarker)

Fader(FloatModel* model, const QString& name, QWidget* parent);
Fader(FloatModel* model, const QString& name, QWidget* parent, const QPixmap& knob);
~Fader() override = default;

void init(FloatModel * model, QString const & name);

void setPeak_L( float fPeak );
void setPeak_L(float fPeak);
float getPeak_L() { return m_fPeakValue_L; }

void setPeak_R( float fPeak );
void setPeak_R(float fPeak);
float getPeak_R() { return m_fPeakValue_R; }

inline float getMinPeak() const { return m_fMinPeak; }
Expand All @@ -89,43 +90,31 @@ class LMMS_EXPORT Fader : public QWidget, public FloatModelView
inline float getMaxPeak() const { return m_fMaxPeak; }
inline void setMaxPeak(float maxPeak) { m_fMaxPeak = maxPeak; }

QColor const & peakGreen() const;
void setPeakGreen( const QColor & c );

QColor const & peakRed() const;
void setPeakRed( const QColor & c );

QColor const & peakYellow() const;
void setPeakYellow( const QColor & c );
inline bool getRenderUnityLine() const { return m_renderUnityLine; }
inline void setRenderUnityLine(bool value = true) { m_renderUnityLine = value; }

inline bool getLevelsDisplayedInDBFS() const { return m_levelsDisplayedInDBFS; }
inline void setLevelsDisplayedInDBFS(bool value = true) { m_levelsDisplayedInDBFS = value; }

void setDisplayConversion( bool b )
void setDisplayConversion(bool b)
{
m_conversionFactor = b ? 100.0 : 1.0;
}

inline void setHintText( const QString & _txt_before,
const QString & _txt_after )
inline void setHintText(const QString& txt_before,
const QString& txt_after)
{
setDescription( _txt_before );
setUnit( _txt_after );
setDescription(txt_before);
setUnit(txt_after);
}

private:
void contextMenuEvent( QContextMenuEvent * _me ) override;
void mousePressEvent( QMouseEvent *ev ) override;
void mouseDoubleClickEvent( QMouseEvent* mouseEvent ) override;
void mouseMoveEvent( QMouseEvent *ev ) override;
void mouseReleaseEvent( QMouseEvent * _me ) override;
void wheelEvent( QWheelEvent *ev ) override;
void paintEvent( QPaintEvent *ev ) override;

inline bool clips(float const & value) const { return value >= 1.0f; }
void contextMenuEvent(QContextMenuEvent* me) override;
void mousePressEvent(QMouseEvent* ev) override;
void mouseDoubleClickEvent(QMouseEvent* mouseEvent) override;
void mouseMoveEvent(QMouseEvent* ev) override;
void mouseReleaseEvent(QMouseEvent* me) override;
void wheelEvent(QWheelEvent* ev) override;
void paintEvent(QPaintEvent* ev) override;

void paintDBFSLevels(QPaintEvent *ev, QPainter & painter);
void paintLinearLevels(QPaintEvent *ev, QPainter & painter);
void paintLevels(QPaintEvent* ev, QPainter& painter, bool linear = false);

int knobPosY() const
{
Expand All @@ -135,37 +124,37 @@ class LMMS_EXPORT Fader : public QWidget, public FloatModelView
return height() - ((height() - m_knob.height()) * (realVal / fRange));
}

void setPeak( float fPeak, float &targetPeak, float &persistentPeak, QElapsedTimer &lastPeakTimer );
int calculateDisplayPeak( float fPeak );
void setPeak(float fPeak, float& targetPeak, float& persistentPeak, QElapsedTimer& lastPeakTimer);

void updateTextFloat();

// Private members
private:
float m_fPeakValue_L;
float m_fPeakValue_R;
float m_persistentPeak_L;
float m_persistentPeak_R;
float m_fMinPeak;
float m_fMaxPeak;
float m_fPeakValue_L {0.};
float m_fPeakValue_R {0.};
float m_persistentPeak_L {0.};
float m_persistentPeak_R {0.};
float m_fMinPeak {dbfsToAmp(-42)};
float m_fMaxPeak {dbfsToAmp(9)};

QElapsedTimer m_lastPeakTimer_L;
QElapsedTimer m_lastPeakTimer_R;

QPixmap m_back;
QPixmap m_leds;
QPixmap m_knob;
QPixmap m_knob {embed::getIconPixmap("fader_knob")};

bool m_levelsDisplayedInDBFS {true};

bool m_levelsDisplayedInDBFS;
int m_moveStartPoint {-1};
float m_startValue {0.};

int m_moveStartPoint;
float m_startValue;
static SimpleTextFloat* s_textFloat;

static SimpleTextFloat * s_textFloat;
QColor m_peakOk {10, 212, 92};
QColor m_peakClip {193, 32, 56};
QColor m_peakWarn {214, 236, 82};
QColor m_unityMarker {63, 63, 63, 255};

QColor m_peakGreen;
QColor m_peakRed;
QColor m_peakYellow;
bool m_renderUnityLine {true};
} ;


Expand Down
31 changes: 27 additions & 4 deletions include/lmms_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

#include "lmms_constants.h"
#include "lmmsconfig.h"
#include <cassert>

namespace lmms
{
Expand Down Expand Up @@ -269,18 +270,18 @@ static inline float safeDbfsToAmp( float dbfs )
//! @brief Converts linear amplitude (>0-1.0) to dBFS scale.
//! @param amp Linear amplitude, where 1.0 = 0dBFS. ** Must be larger than zero! **
//! @return Amplitude in dBFS.
static inline float ampToDbfs( float amp )
static inline float ampToDbfs(float amp)
{
return log10f( amp ) * 20.0f;
return log10f(amp) * 20.0f;
}


//! @brief Converts dBFS-scale to linear amplitude with 0dBFS = 1.0
//! @param dbfs The dBFS value to convert. ** Must be a real number - not inf/nan! **
//! @return Linear amplitude
static inline float dbfsToAmp( float dbfs )
static inline float dbfsToAmp(float dbfs)
{
return std::pow(10.f, dbfs * 0.05f );
return std::pow(10.f, dbfs * 0.05f);
}


Expand Down Expand Up @@ -352,6 +353,28 @@ static inline int numDigitsAsInt(float f)
return digits;
}

template <typename T>
class LinearMap
{
public:
LinearMap(T x1, T y1, T x2, T y2)
{
T const dx = x2 - x1;
assert (dx != T(0));

m_a = (y2 - y1) / dx;
m_b = y1 - m_a * x1;
}

T map(T x) const
{
return m_a * x + m_b;
}

private:
T m_a;
T m_b;
};

} // namespace lmms

Expand Down
19 changes: 12 additions & 7 deletions plugins/CrossoverEQ/CrossoverEQControlDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#include "Knob.h"
#include "Fader.h"

#include <QPixmap>


namespace lmms::gui
{

Expand Down Expand Up @@ -64,30 +67,32 @@ CrossoverEQControlDialog::CrossoverEQControlDialog( CrossoverEQControls * contro
xover34->setLabel( "3/4" );
xover34->setHintText( tr( "Band 3/4 crossover:" ), " Hz" );

m_fader_bg = QPixmap( PLUGIN_NAME::getIconPixmap( "fader_bg" ) );
m_fader_empty = QPixmap( PLUGIN_NAME::getIconPixmap( "fader_empty" ) );
m_fader_knob = QPixmap( PLUGIN_NAME::getIconPixmap( "fader_knob2" ) );
QPixmap const fader_knob(PLUGIN_NAME::getIconPixmap("fader_knob2"));

// faders
auto gain1 = new Fader(&controls->m_gain1, tr("Band 1 gain"), this, &m_fader_bg, &m_fader_empty, &m_fader_knob);
auto gain1 = new Fader(&controls->m_gain1, tr("Band 1 gain"), this, fader_knob);
gain1->move( 7, 56 );
gain1->setDisplayConversion( false );
gain1->setHintText( tr( "Band 1 gain:" ), " dBFS" );
gain1->setRenderUnityLine(false);

auto gain2 = new Fader(&controls->m_gain2, tr("Band 2 gain"), this, &m_fader_bg, &m_fader_empty, &m_fader_knob);
auto gain2 = new Fader(&controls->m_gain2, tr("Band 2 gain"), this, fader_knob);
gain2->move( 47, 56 );
gain2->setDisplayConversion( false );
gain2->setHintText( tr( "Band 2 gain:" ), " dBFS" );
gain2->setRenderUnityLine(false);

auto gain3 = new Fader(&controls->m_gain3, tr("Band 3 gain"), this, &m_fader_bg, &m_fader_empty, &m_fader_knob);
auto gain3 = new Fader(&controls->m_gain3, tr("Band 3 gain"), this, fader_knob);
gain3->move( 87, 56 );
gain3->setDisplayConversion( false );
gain3->setHintText( tr( "Band 3 gain:" ), " dBFS" );
gain3->setRenderUnityLine(false);

auto gain4 = new Fader(&controls->m_gain4, tr("Band 4 gain"), this, &m_fader_bg, &m_fader_empty, &m_fader_knob);
auto gain4 = new Fader(&controls->m_gain4, tr("Band 4 gain"), this, fader_knob);
gain4->move( 127, 56 );
gain4->setDisplayConversion( false );
gain4->setHintText( tr( "Band 4 gain:" ), " dBFS" );
gain4->setRenderUnityLine(false);

// leds
auto mute1 = new LedCheckBox("", this, tr("Band 1 mute"), LedCheckBox::LedColor::Green);
Expand Down
6 changes: 0 additions & 6 deletions plugins/CrossoverEQ/CrossoverEQControlDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#ifndef CROSSOVEREQ_CONTROL_DIALOG_H
#define CROSSOVEREQ_CONTROL_DIALOG_H

#include <QPixmap>
#include "EffectControlDialog.h"

namespace lmms
Expand All @@ -46,11 +45,6 @@ class CrossoverEQControlDialog : public EffectControlDialog
public:
CrossoverEQControlDialog( CrossoverEQControls * controls );
~CrossoverEQControlDialog() override = default;

private:
QPixmap m_fader_bg;
QPixmap m_fader_empty;
QPixmap m_fader_knob;
};


Expand Down
Binary file removed plugins/CrossoverEQ/fader_bg.png
Binary file not shown.
Binary file removed plugins/CrossoverEQ/fader_empty.png
Binary file not shown.
2 changes: 2 additions & 0 deletions plugins/Eq/EqControls.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ class EqControls : public EffectControls
float m_inPeakR;
float m_outPeakL;
float m_outPeakR;

// The following are linear peaks
float m_lowShelfPeakL, m_lowShelfPeakR;
float m_para1PeakL, m_para1PeakR;
float m_para2PeakL, m_para2PeakR;
Expand Down
17 changes: 8 additions & 9 deletions plugins/Eq/EqControlsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,16 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
setBand( 6, &controls->m_highShelfActiveModel, &controls->m_highShelfFreqModel, &controls->m_highShelfResModel, &controls->m_highShelfGainModel, QColor(255 ,255, 255), tr( "High-shelf" ), &controls->m_highShelfPeakL, &controls->m_highShelfPeakR,0,0,0,0,0,0 );
setBand( 7, &controls->m_lpActiveModel, &controls->m_lpFreqModel, &controls->m_lpResModel, 0, QColor(255 ,255, 255), tr( "LP" ) ,0,0,0,0,0, &controls->m_lp12Model, &controls->m_lp24Model, &controls->m_lp48Model);

static auto s_faderBg = PLUGIN_NAME::getIconPixmap("faderback");
static auto s_faderLeds = PLUGIN_NAME::getIconPixmap("faderleds");
static auto s_faderKnob = PLUGIN_NAME::getIconPixmap("faderknob");
QSize const faderSize(23, 80);

auto GainFaderIn = new EqFader(&controls->m_inGainModel, tr("Input gain"), this, &s_faderBg, &s_faderLeds, &s_faderKnob,
&controls->m_inPeakL, &controls->m_inPeakR);
auto GainFaderIn = new EqFader(&controls->m_inGainModel, tr("Input gain"), this, &controls->m_inPeakL, &controls->m_inPeakR);
GainFaderIn->setFixedSize(faderSize);
GainFaderIn->move( 23, 295 );
GainFaderIn->setDisplayConversion( false );
GainFaderIn->setHintText( tr( "Gain" ), "dBv");

auto GainFaderOut = new EqFader(&controls->m_outGainModel, tr("Output gain"), this, &s_faderBg, &s_faderLeds, &s_faderKnob,
&controls->m_outPeakL, &controls->m_outPeakR);
auto GainFaderOut = new EqFader(&controls->m_outGainModel, tr("Output gain"), this, &controls->m_outPeakL, &controls->m_outPeakR);
GainFaderOut->setFixedSize(faderSize);
GainFaderOut->move( 453, 295);
GainFaderOut->setDisplayConversion( false );
GainFaderOut->setHintText( tr( "Gain" ), "dBv" );
Expand All @@ -92,8 +90,9 @@ EqControlsDialog::EqControlsDialog( EqControls *controls ) :
int distance = 126;
for( int i = 1; i < m_parameterWidget->bandCount() - 1; i++ )
{
auto gainFader = new EqFader(m_parameterWidget->getBandModels(i)->gain, tr(""), this, &s_faderBg, &s_faderLeds,
&s_faderKnob, m_parameterWidget->getBandModels(i)->peakL, m_parameterWidget->getBandModels(i)->peakR);
auto gainFader = new EqFader(m_parameterWidget->getBandModels(i)->gain, tr(""), this,
m_parameterWidget->getBandModels(i)->peakL, m_parameterWidget->getBandModels(i)->peakR);
gainFader->setFixedSize(faderSize);
gainFader->move( distance, 295 );
distance += 44;
gainFader->setMinimumHeight(80);
Expand Down
Loading

0 comments on commit ba4fda7

Please sign in to comment.