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:
Michael Gregorius
2024-12-24 13:46:02 +01:00
parent f8e0bf5184
commit def44aee63
4 changed files with 91 additions and 57 deletions

View File

@@ -70,25 +70,25 @@ CrossoverEQControlDialog::CrossoverEQControlDialog( CrossoverEQControls * contro
QPixmap const fader_knob(PLUGIN_NAME::getIconPixmap("fader_knob2"));
// faders
auto gain1 = new Fader(&controls->m_gain1, tr("Band 1 gain"), this, fader_knob);
auto gain1 = new Fader(&controls->m_gain1, tr("Band 1 gain"), this, fader_knob, false);
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, fader_knob);
auto gain2 = new Fader(&controls->m_gain2, tr("Band 2 gain"), this, fader_knob, false);
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, fader_knob);
auto gain3 = new Fader(&controls->m_gain3, tr("Band 3 gain"), this, fader_knob, false);
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, fader_knob);
auto gain4 = new Fader(&controls->m_gain4, tr("Band 4 gain"), this, fader_knob, false);
gain4->move( 127, 56 );
gain4->setDisplayConversion( false );
gain4->setHintText( tr( "Band 4 gain:" ), " dBFS" );

View File

@@ -43,7 +43,7 @@ public:
Q_OBJECT
public:
EqFader( FloatModel * model, const QString & name, QWidget * parent, float* lPeak, float* rPeak ) :
Fader( model, name, parent )
Fader(model, name, parent, false)
{
setMinimumSize( 23, 116 );
setMaximumSize( 23, 116 );