LMMS
Loading...
Searching...
No Matches
CompressorControlDialog.h
Go to the documentation of this file.
1/*
2 * CompressorControlDialog.h
3 *
4 * Copyright (c) 2020 Lost Robot <r94231@gmail.com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25#ifndef COMPRESSOR_CONTROL_DIALOG_H
26#define COMPRESSOR_CONTROL_DIALOG_H
27
28#include <QBasicTimer>
29#include <QElapsedTimer>
30#include <QPainter>
31
32#include "EffectControlDialog.h"
33
34class QLabel;
35
36namespace lmms
37{
38
39constexpr float COMP_NOISE_FLOOR = 0.000001f;// -120 dbFs
40
42
43
44namespace gui
45{
46
47constexpr int COMP_MILLI_PER_PIXEL = 6;
48constexpr int MIN_COMP_SCREEN_X = 800;
49constexpr int MIN_COMP_SCREEN_Y = 360;
50constexpr int MAX_COMP_SCREEN_X = 1920;
51constexpr int MAX_COMP_SCREEN_Y = 1080;
52constexpr int COMP_SCREEN_X = 800;
53constexpr int COMP_SCREEN_Y = 560;
56constexpr int COMP_KNEE_LINES = 20;
57constexpr int COMP_BOX_X = 720;
58constexpr int COMP_BOX_Y = 280;
59constexpr float COMP_GRID_SPACING = 3.f;// 3 db per grid line
60constexpr float COMP_GRID_MAX = 96.f;// Can't zoom out past 96 db
61
63class Knob;
64class PixmapButton;
65class EqFader;
66
67
69{
70 Q_OBJECT
71public:
73
74 QSize sizeHint() const override {return QSize(COMP_SCREEN_X, COMP_SCREEN_Y);}
75
76 // For theming purposes
77 Q_PROPERTY(QColor inVolAreaColor MEMBER m_inVolAreaColor)
78 Q_PROPERTY(QColor inVolColor MEMBER m_inVolColor)
79 Q_PROPERTY(QColor outVolAreaColor MEMBER m_outVolAreaColor)
80 Q_PROPERTY(QColor outVolColor MEMBER m_outVolColor)
81 Q_PROPERTY(QColor gainReductionColor MEMBER m_gainReductionColor)
82 Q_PROPERTY(QColor kneeColor MEMBER m_kneeColor)
83 Q_PROPERTY(QColor kneeColor2 MEMBER m_kneeColor2)
84 Q_PROPERTY(QColor threshColor MEMBER m_threshColor)
85 Q_PROPERTY(QColor textColor MEMBER m_textColor)
86 Q_PROPERTY(QColor graphColor MEMBER m_graphColor)
87 Q_PROPERTY(QColor resetColor MEMBER m_resetColor)
88 Q_PROPERTY(QColor backgroundColor MEMBER m_backgroundColor)
89
90protected:
91 void resizeEvent(QResizeEvent *event) override;
92 void paintEvent(QPaintEvent *event) override;
93 void wheelEvent(QWheelEvent *event) override;
94
95private slots:
96 void updateDisplay();
97 void peakmodeChanged();
98 void stereoLinkChanged();
99 void lookaheadChanged();
100 void limiterChanged();
101
102private:
103 void makeLargeKnob(Knob * knob, QString hint, QString unit);
104 void makeSmallKnob(Knob * knob, QString hint, QString unit);
105 void resetCompressorView();
106 void drawVisPixmap();
107 void redrawKnee();
108 void drawKneePixmap2();
109 void drawMiscPixmap();
110 void drawGraph();
111 void mouseDoubleClickEvent(QMouseEvent* event) override;
112 void setGuiVisibility(bool isVisible);
113
114 QPainter m_p;
115
116 QBasicTimer m_updateTimer;
117
119
120 inline int dbfsToYPoint(float inDbfs);
121 inline int dbfsToXPoint(float inDbfs);
122
128
132
139
140 float m_dbRange = 36;
141
142 QColor m_inVolAreaColor = QColor(209, 216, 228, 17);
143 QColor m_inVolColor = QColor(209, 216, 228, 100);
144 QColor m_outVolAreaColor = QColor(209, 216, 228, 30);
145 QColor m_outVolColor = QColor(209, 216, 228, 240);
146 QColor m_gainReductionColor = QColor(180, 100, 100, 210);
147 QColor m_kneeColor = QColor(39, 171, 95, 255);
148 QColor m_kneeColor2 = QColor(9, 171, 160, 255);
149 QColor m_threshColor = QColor(39, 171, 95, 100);
150 QColor m_textColor = QColor(209, 216, 228, 50);
151 QColor m_graphColor = QColor(209, 216, 228, 50);
152 QColor m_resetColor = QColor(200, 100, 15, 200);
153 QColor m_backgroundColor = QColor(7, 8, 9, 255);
154
157
158 float m_yPoint;
160
163
165
171
180
189
192
195
199
203
207
214
219
221
222 QElapsedTimer m_timeElapsed;
224
225 friend class CompressorControls;
226} ;
227
228
229
230} // namespace gui
231
232} // namespace lmms
233
234#endif
#define override
Definition DistrhoDefines.h:73
Definition CompressorControls.h:39
Definition AutomatableButton.h:84
Knob * m_autoReleaseKnob
Definition CompressorControlDialog.h:191
QColor textColor
Definition CompressorControlDialog.h:85
QPixmap m_visPixmap
Definition CompressorControlDialog.h:123
PixmapButton * leftRightButton
Definition CompressorControlDialog.h:200
float m_peakAvg
Definition CompressorControlDialog.h:155
Knob * m_stereoBalanceKnob
Definition CompressorControlDialog.h:184
Knob * m_releaseKnob
Definition CompressorControlDialog.h:175
void resizeEvent(QResizeEvent *event) override
Definition CompressorControlDialog.cpp:640
int m_controlsBoxX
Definition CompressorControlDialog.h:137
QPixmap m_miscPixmap
Definition CompressorControlDialog.h:126
QElapsedTimer m_timeElapsed
Definition CompressorControlDialog.h:222
PixmapButton * autoMakeupButton
Definition CompressorControlDialog.h:215
void paintEvent(QPaintEvent *event) override
Definition CompressorControlDialog.cpp:601
float m_yGainPoint
Definition CompressorControlDialog.h:159
QColor kneeColor
Definition CompressorControlDialog.h:82
int m_windowSizeX
Definition CompressorControlDialog.h:133
QPainter m_p
Definition CompressorControlDialog.h:114
QLabel * m_controlsBoxLabel
Definition CompressorControlDialog.h:166
QColor m_gainReductionColor
Definition CompressorControlDialog.h:146
int m_kneeWindowSizeX
Definition CompressorControlDialog.h:135
void drawGraph()
Definition CompressorControlDialog.cpp:662
CompressorControls * m_controls
Definition CompressorControlDialog.h:118
Knob * m_ratioKnob
Definition CompressorControlDialog.h:173
void updateDisplay()
Definition CompressorControlDialog.cpp:360
int m_lastPoint
Definition CompressorControlDialog.h:129
Knob * m_thresholdKnob
Definition CompressorControlDialog.h:172
void redrawKnee()
Definition CompressorControlDialog.cpp:475
PixmapButton * unlinkedButton
Definition CompressorControlDialog.h:208
QColor m_outVolColor
Definition CompressorControlDialog.h:145
PixmapButton * blendButton
Definition CompressorControlDialog.h:212
QLabel * m_blendEnabledLabel
Definition CompressorControlDialog.h:168
QSize sizeHint() const override
Definition CompressorControlDialog.h:74
Knob * m_blendKnob
Definition CompressorControlDialog.h:185
QPixmap m_graphPixmap
Definition CompressorControlDialog.h:127
QPixmap m_kneePixmap2
Definition CompressorControlDialog.h:125
QColor m_kneeColor2
Definition CompressorControlDialog.h:148
void drawKneePixmap2()
Definition CompressorControlDialog.cpp:555
void resetCompressorView()
Definition CompressorControlDialog.cpp:763
void makeLargeKnob(Knob *knob, QString hint, QString unit)
Definition CompressorControlDialog.cpp:310
QLabel * m_rmsEnabledLabel
Definition CompressorControlDialog.h:167
QLabel * m_ratioEnabledLabel
Definition CompressorControlDialog.h:170
PixmapButton * minimumButton
Definition CompressorControlDialog.h:211
int dbfsToYPoint(float inDbfs)
Definition CompressorControlDialog.cpp:629
QColor inVolColor
Definition CompressorControlDialog.h:78
QColor backgroundColor
Definition CompressorControlDialog.h:88
EqFader * m_outFader
Definition CompressorControlDialog.h:193
int m_threshXPoint
Definition CompressorControlDialog.h:162
QPixmap m_kneePixmap
Definition CompressorControlDialog.h:124
QColor inVolAreaColor
Definition CompressorControlDialog.h:77
CompressorControlDialog(CompressorControls *controls)
Definition CompressorControlDialog.cpp:46
void wheelEvent(QWheelEvent *event) override
Definition CompressorControlDialog.cpp:646
PixmapButton * midSideButton
Definition CompressorControlDialog.h:201
int m_controlsBoxY
Definition CompressorControlDialog.h:138
int m_windowSizeY
Definition CompressorControlDialog.h:134
void limiterChanged()
Definition CompressorControlDialog.cpp:353
Knob * m_attackKnob
Definition CompressorControlDialog.h:174
Knob * m_rmsKnob
Definition CompressorControlDialog.h:181
Knob * m_kneeKnob
Definition CompressorControlDialog.h:176
Knob * m_inBalanceKnob
Definition CompressorControlDialog.h:182
PixmapButton * auditionButton
Definition CompressorControlDialog.h:216
QColor m_threshColor
Definition CompressorControlDialog.h:149
PixmapButton * feedbackButton
Definition CompressorControlDialog.h:217
PixmapButton * averageButton
Definition CompressorControlDialog.h:210
PixmapButton * peakButton
Definition CompressorControlDialog.h:197
float m_gainAvg
Definition CompressorControlDialog.h:156
PixmapButton * rmsButton
Definition CompressorControlDialog.h:196
void drawVisPixmap()
Definition CompressorControlDialog.cpp:423
PixmapButton * compressButton
Definition CompressorControlDialog.h:204
void setGuiVisibility(bool isVisible)
Definition CompressorControlDialog.cpp:696
int m_kneeWindowSizeY
Definition CompressorControlDialog.h:136
int dbfsToXPoint(float inDbfs)
Definition CompressorControlDialog.cpp:634
QColor threshColor
Definition CompressorControlDialog.h:84
void stereoLinkChanged()
Definition CompressorControlDialog.cpp:338
PixmapButton * lookaheadButton
Definition CompressorControlDialog.h:218
QColor resetColor
Definition CompressorControlDialog.h:87
EqFader * m_inFader
Definition CompressorControlDialog.h:194
Knob * m_mixKnob
Definition CompressorControlDialog.h:188
bool m_guiVisibility
Definition CompressorControlDialog.h:220
QColor m_kneeColor
Definition CompressorControlDialog.h:147
Knob * m_tiltKnob
Definition CompressorControlDialog.h:186
PixmapButton * limitButton
Definition CompressorControlDialog.h:205
Knob * m_rangeKnob
Definition CompressorControlDialog.h:177
QColor gainReductionColor
Definition CompressorControlDialog.h:81
AutomatableButtonGroup * compressLimitGroup
Definition CompressorControlDialog.h:206
int m_lastGainPoint
Definition CompressorControlDialog.h:130
int m_threshYPoint
Definition CompressorControlDialog.h:161
QColor m_graphColor
Definition CompressorControlDialog.h:151
int m_timeSinceLastUpdate
Definition CompressorControlDialog.h:223
QColor graphColor
Definition CompressorControlDialog.h:86
QColor m_textColor
Definition CompressorControlDialog.h:150
AutomatableButtonGroup * rmsPeakGroup
Definition CompressorControlDialog.h:198
void lookaheadChanged()
Definition CompressorControlDialog.cpp:345
Knob * m_outBalanceKnob
Definition CompressorControlDialog.h:183
QColor outVolAreaColor
Definition CompressorControlDialog.h:79
void peakmodeChanged()
Definition CompressorControlDialog.cpp:331
PixmapButton * maximumButton
Definition CompressorControlDialog.h:209
Knob * m_lookaheadLengthKnob
Definition CompressorControlDialog.h:178
QColor m_backgroundColor
Definition CompressorControlDialog.h:153
void mouseDoubleClickEvent(QMouseEvent *event) override
Definition CompressorControlDialog.cpp:690
Knob * m_tiltFreqKnob
Definition CompressorControlDialog.h:187
float m_dbRange
Definition CompressorControlDialog.h:140
QBasicTimer m_updateTimer
Definition CompressorControlDialog.h:116
QColor m_outVolAreaColor
Definition CompressorControlDialog.h:144
QLabel * m_lookaheadEnabledLabel
Definition CompressorControlDialog.h:169
AutomatableButtonGroup * leftRightMidSideGroup
Definition CompressorControlDialog.h:202
QColor m_inVolColor
Definition CompressorControlDialog.h:143
int m_compPixelMovement
Definition CompressorControlDialog.h:164
friend class CompressorControls
Definition CompressorControlDialog.h:225
QColor m_resetColor
Definition CompressorControlDialog.h:152
int m_lastKneePoint
Definition CompressorControlDialog.h:131
AutomatableButtonGroup * stereoLinkGroup
Definition CompressorControlDialog.h:213
Knob * m_autoAttackKnob
Definition CompressorControlDialog.h:190
Knob * m_holdKnob
Definition CompressorControlDialog.h:179
QColor outVolColor
Definition CompressorControlDialog.h:80
QColor m_inVolAreaColor
Definition CompressorControlDialog.h:142
QColor kneeColor2
Definition CompressorControlDialog.h:83
void makeSmallKnob(Knob *knob, QString hint, QString unit)
Definition CompressorControlDialog.cpp:320
float m_yPoint
Definition CompressorControlDialog.h:158
void drawMiscPixmap()
Definition CompressorControlDialog.cpp:579
EffectControlDialog(EffectControls *controls)
Definition EffectControlDialog.cpp:33
Definition EqFader.h:40
Definition Knob.h:47
Definition PixmapButton.h:37
static PuglViewHint hint
Definition pugl.h:1707
static int int height
Definition pugl.h:1594
static int width
Definition pugl.h:1593
Definition AudioPortAudio.cpp:223
constexpr int MIN_COMP_SCREEN_Y
Definition CompressorControlDialog.h:49
constexpr int MAX_COMP_SCREEN_X
Definition CompressorControlDialog.h:50
constexpr int MIN_COMP_SCREEN_X
Definition CompressorControlDialog.h:48
constexpr int COMP_SCREEN_Y
Definition CompressorControlDialog.h:53
constexpr int COMP_MILLI_PER_PIXEL
Definition CompressorControlDialog.h:47
constexpr int COMP_BOX_X
Definition CompressorControlDialog.h:57
constexpr int MAX_COMP_SCREEN_Y
Definition CompressorControlDialog.h:51
constexpr int KNEE_SCREEN_Y
Definition CompressorControlDialog.h:55
constexpr int COMP_SCREEN_X
Definition CompressorControlDialog.h:52
constexpr float COMP_GRID_MAX
Definition CompressorControlDialog.h:60
constexpr int COMP_BOX_Y
Definition CompressorControlDialog.h:58
constexpr int KNEE_SCREEN_X
Definition CompressorControlDialog.h:54
constexpr int COMP_KNEE_LINES
Definition CompressorControlDialog.h:56
constexpr float COMP_GRID_SPACING
Definition CompressorControlDialog.h:59
Definition AudioAlsa.cpp:35
constexpr float COMP_NOISE_FLOOR
Definition CompressorControlDialog.h:39
#define true
Definition ordinals.h:82
png_const_structrp png_const_inforp int * unit
Definition png.h:2161
ulg size
Definition extract.c:2350