LMMS
Loading...
Searching...
No Matches
EqFader.h
Go to the documentation of this file.
1/* eqfader.h - defination of EqFader class.
2*
3* Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
4*
5* This file is part of LMMS - https://lmms.io
6*
7* This program is free software; you can redistribute it and/or
8* modify it under the terms of the GNU General Public
9* License as published by the Free Software Foundation; either
10* version 2 of the License, or (at your option) any later version.
11*
12* This program is distributed in the hope that it will be useful,
13* but WITHOUT ANY WARRANTY; without even the implied warranty of
14* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15* General Public License for more details.
16*
17* You should have received a copy of the GNU General Public
18* License along with this program (see COPYING); if not, write to the
19* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20* Boston, MA 02110-1301 USA.
21*
22*/
23
24#ifndef EQFADER_H
25#define EQFADER_H
26#include <QList>
27#include <QWidget>
28
29#include "EffectControls.h"
30#include "Fader.h"
31#include "GuiApplication.h"
32#include "MainWindow.h"
33#include "TextFloat.h"
34
35namespace lmms::gui
36{
37
38
39class EqFader : public Fader
40{
41
42public:
43 Q_OBJECT
44public:
45 EqFader( FloatModel * model, const QString & name, QWidget * parent, float* lPeak, float* rPeak ) :
47 {
48 setMinimumSize( 23, 116 );
49 setMaximumSize( 23, 116 );
50 resize( 23, 116 );
51 m_lPeak = lPeak;
52 m_rPeak = rPeak;
53 connect( getGUI()->mainWindow(), SIGNAL( periodicUpdate() ), this, SLOT( updateVuMeters() ) );
54 m_model = model;
55 setPeak_L( 0 );
56 setPeak_R( 0 );
57 }
58
59
60
61 ~EqFader() override = default;
62
63
64private slots:
65
67 {
68 const float opl = getPeak_L();
69 const float opr = getPeak_R();
70 const float fallOff = 1.07f;
71 if( *m_lPeak > opl )
72 {
74 *m_lPeak = 0;
75 }
76 else
77 {
78 setPeak_L( opl/fallOff );
79 }
80
81 if( *m_rPeak > opr )
82 {
84 *m_rPeak = 0;
85 }
86 else
87 {
88 setPeak_R( opr/fallOff );
89 }
90 update();
91 }
92
93
94
95
96private:
97 float* m_lPeak;
98 float* m_rPeak;
100
101};
102
103
104} // namespace lmms::gui
105
106#endif // EQFADER_H
Definition AutomatableModel.h:463
float * m_rPeak
Definition EqFader.h:98
FloatModel * m_model
Definition EqFader.h:99
EqFader(FloatModel *model, const QString &name, QWidget *parent, float *lPeak, float *rPeak)
Definition EqFader.h:45
void updateVuMeters()
Definition EqFader.h:66
~EqFader() override=default
float * m_lPeak
Definition EqFader.h:97
void setPeak_R(float fPeak)
Definition Fader.cpp:489
Fader(FloatModel *model, const QString &name, QWidget *parent, bool modelIsLinear=true)
Definition Fader.cpp:73
float getPeak_R()
Definition Fader.h:85
float getPeak_L()
Definition Fader.h:82
void setPeak_L(float fPeak)
Definition Fader.cpp:482
FloatModel * model()
Definition AutomatableModelView.h:121
static const char * name
Definition pugl.h:1582
static uintptr_t parent
Definition pugl.h:1644
Definition AudioPortAudio.cpp:223
GuiApplication * getGUI()
Definition GuiApplication.cpp:69
#define false
Definition ordinals.h:83
#define SIGNAL
Definition tap_pinknoise.c:34