Render the mixer levels in a dB FS scale (#2672)
* Render the mixer levels in a dB FS scale Adds the option to render the mixer levels in dB FS. By default this option is disabled so that classes which inherit from Fader are not affected by this change. However, in the code of the FxMixerView this feature is enabled so that the mixer shows the levels in dB FS. The ability to render in dB FS is exported as a property so that it can also be set in a style sheet (not used as of now). The new property is called "levelsDisplayedInDBFS". There are now setters and getters for the min and max level. Showing the levels in dB FS (which is a logarithmic scale) gives a less "fidgety" impression when the levels are moving. * Introduction of an init method in Fader An init method was added to unify the initialization of the two Fader constructors.
This commit is contained in:
committed by
Umcaruje
parent
04ee0910af
commit
52ec3874b1
@@ -63,25 +63,40 @@ class EXPORT Fader : public QWidget, public FloatModelView
|
||||
public:
|
||||
Q_PROPERTY( QColor peakGreen READ peakGreen WRITE setPeakGreen )
|
||||
Q_PROPERTY( QColor peakRed READ peakRed WRITE setPeakRed )
|
||||
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 );
|
||||
virtual ~Fader();
|
||||
|
||||
void init(FloatModel * model, QString const & name);
|
||||
|
||||
void setPeak_L( float fPeak );
|
||||
float getPeak_L() { return m_fPeakValue_L; }
|
||||
|
||||
void setPeak_R( float fPeak );
|
||||
float getPeak_R() { return m_fPeakValue_R; }
|
||||
|
||||
QColor peakGreen() const;
|
||||
QColor peakRed() const;
|
||||
inline float getMinPeak() const { return m_fMinPeak; }
|
||||
inline void setMinPeak(float minPeak) { m_fMinPeak = minPeak; }
|
||||
|
||||
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 );
|
||||
|
||||
inline bool getLevelsDisplayedInDBFS() const { return m_levelsDisplayedInDBFS; }
|
||||
inline void setLevelsDisplayedInDBFS(bool value = true) { m_levelsDisplayedInDBFS = value; }
|
||||
|
||||
void setDisplayConversion( bool b )
|
||||
{
|
||||
m_displayConversion = b;
|
||||
}
|
||||
|
||||
inline void setHintText( const QString & _txt_before,
|
||||
const QString & _txt_after )
|
||||
{
|
||||
@@ -98,6 +113,11 @@ private:
|
||||
virtual void wheelEvent( QWheelEvent *ev );
|
||||
virtual void paintEvent( QPaintEvent *ev );
|
||||
|
||||
inline bool clips(float const & value) const { return value > 1.0f; }
|
||||
|
||||
void paintDBFSLevels(QPaintEvent *ev, QPainter & painter);
|
||||
void paintLinearLevels(QPaintEvent *ev, QPainter & painter);
|
||||
|
||||
int knobPosY() const
|
||||
{
|
||||
float fRange = model()->maxValue() - model()->minValue();
|
||||
@@ -109,12 +129,16 @@ private:
|
||||
void setPeak( float fPeak, float &targetPeak, float &persistentPeak, QTime &lastPeakTime );
|
||||
int calculateDisplayPeak( float fPeak );
|
||||
|
||||
void updateTextFloat();
|
||||
|
||||
// Private members
|
||||
private:
|
||||
float m_fPeakValue_L;
|
||||
float m_fPeakValue_R;
|
||||
float m_persistentPeak_L;
|
||||
float m_persistentPeak_R;
|
||||
const float m_fMinPeak;
|
||||
const float m_fMaxPeak;
|
||||
float m_fMinPeak;
|
||||
float m_fMaxPeak;
|
||||
|
||||
QTime m_lastPeakTime_L;
|
||||
QTime m_lastPeakTime_R;
|
||||
@@ -128,12 +152,12 @@ private:
|
||||
QPixmap * m_knob;
|
||||
|
||||
bool m_displayConversion;
|
||||
bool m_levelsDisplayedInDBFS;
|
||||
|
||||
int m_moveStartPoint;
|
||||
float m_startValue;
|
||||
|
||||
static TextFloat * s_textFloat;
|
||||
void updateTextFloat();
|
||||
|
||||
QColor m_peakGreen;
|
||||
QColor m_peakRed;
|
||||
|
||||
Reference in New Issue
Block a user