Support for dB models
Add support for models that are in dB. There's a new member `m_modelIsLinear` which can be set via the constructor. The default value in the constructor is `true`. Add the method `modelIsLinear` which can be used to query the parameter. It is used in `calculateKnobPosYFromModel` and `setVolumeByLocalPixelValue`. Both methods got extended to deal with models in dB. They were also refactored to extract code that is common for both cases. Ensure that the constructor of `Fader` is called with `false` for `CrossoverEQControlDialog` and `EqFader` because these use models that are in dB.
This commit is contained in:
@@ -74,8 +74,8 @@ public:
|
||||
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(FloatModel* model, const QString& name, QWidget* parent, bool modelIsLinear = true);
|
||||
Fader(FloatModel* model, const QString& name, QWidget* parent, const QPixmap& knob, bool modelIsLinear = true);
|
||||
~Fader() override = default;
|
||||
|
||||
void setPeak_L(float fPeak);
|
||||
@@ -126,6 +126,8 @@ private:
|
||||
|
||||
void updateTextFloat();
|
||||
|
||||
bool modelIsLinear() const { return m_modelIsLinear; }
|
||||
|
||||
// Private members
|
||||
private:
|
||||
float m_fPeakValue_L {0.};
|
||||
@@ -141,6 +143,7 @@ private:
|
||||
QPixmap m_knob {embed::getIconPixmap("fader_knob")};
|
||||
|
||||
bool m_levelsDisplayedInDBFS {true};
|
||||
bool m_modelIsLinear {false};
|
||||
|
||||
// The dbFS amount after which we drop down to -inf dbFS
|
||||
float const m_faderMinDb {-120.};
|
||||
|
||||
Reference in New Issue
Block a user