1 /*
2 * eqcontrols.cpp - defination of EqControls class.
3 *
4 * Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/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 #include "EqControls.h"
26
27 #include <QtXml/QDomElement>
28
29 #include "EqControlsDialog.h"
30 #include "EqEffect.h"
31
32
33
EqControls(EqEffect * effect)34 EqControls::EqControls( EqEffect *effect ) :
35 EffectControls( effect ),
36 m_effect( effect ),
37 m_inGainModel( 0.0, -60.0, 20.0, 0.01, this, tr( "Input gain") ),
38 m_outGainModel( -.0, -60.0, 20.0, 0.01, this, tr( "Output gain" ) ),
39 m_lowShelfGainModel( 0.0 , -18, 18, 0.001, this, tr( "Low shelf gain" ) ),
40 m_para1GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 1 gain" ) ),
41 m_para2GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 2 gain" ) ),
42 m_para3GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 3 gain" ) ),
43 m_para4GainModel( 0.0 , -18, 18, 0.001, this, tr( "Peak 4 gain" ) ),
44 m_highShelfGainModel( 0.0 , -18, 18, 0.001, this, tr( "High Shelf gain" ) ),
45 m_hpResModel( 0.707,0.003, 10.0 , 0.001, this, tr( "HP res" ) ),
46 m_lowShelfResModel( 1.4,0.55, 10.0 , 0.001, this , tr( "Low Shelf res" ) ),
47 m_para1BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 1 BW" ) ),
48 m_para2BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 2 BW" ) ),
49 m_para3BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 3 BW" ) ),
50 m_para4BwModel( 0.3, 0.1, 4 , 0.001, this , tr( "Peak 4 BW" ) ),
51 m_highShelfResModel( 1.4, 0.55, 10.0 , 0.001, this , tr( "High Shelf res" ) ),
52 m_lpResModel( 0.707,0.003, 10.0 , 0.001, this , tr( "LP res" ) ),
53 m_hpFeqModel( 31.0, 20.0, 20000, 0.001, this , tr( "HP freq" ) ),
54 m_lowShelfFreqModel( 80.0, 20.0, 20000, 0.001, this , tr( "Low Shelf freq" ) ),
55 m_para1FreqModel( 120.0, 20.0, 20000, 0.001, this , tr( "Peak 1 freq" ) ),
56 m_para2FreqModel( 250.0, 20.0, 20000, 0.001, this, tr( "Peak 2 freq" ) ),
57 m_para3FreqModel( 2000.0, 20.0, 20000, 0.001, this , tr( "Peak 3 freq" ) ),
58 m_para4FreqModel( 4000.0, 20.0, 20000, 0.001, this , tr( "Peak 4 freq" ) ),
59 m_highShelfFreqModel( 12000.0, 20.0, 20000, 0.001, this , tr( "High shelf freq" ) ),
60 m_lpFreqModel( 18000.0, 20.0, 20000, 0.001, this , tr( "LP freq" ) ),
61 m_hpActiveModel( false, this , tr( "HP active" ) ),
62 m_lowShelfActiveModel( false, this , tr( "Low shelf active" ) ),
63 m_para1ActiveModel( false, this , tr( "Peak 1 active" ) ),
64 m_para2ActiveModel( false, this , tr( "Peak 2 active" ) ),
65 m_para3ActiveModel( false, this , tr( "Peak 3 active" ) ),
66 m_para4ActiveModel( false, this , tr( "Peak 4 active" ) ),
67 m_highShelfActiveModel( false, this , tr( "High shelf active" ) ),
68 m_lpActiveModel( false, this , tr( "LP active" ) ),
69 m_lp12Model( false, this , tr( "LP 12" ) ),
70 m_lp24Model( false, this , tr( "LP 24" ) ),
71 m_lp48Model( false, this , tr( "LP 48" ) ),
72 m_hp12Model( false, this , tr( "HP 12" ) ),
73 m_hp24Model( false, this , tr( "HP 24" ) ),
74 m_hp48Model( false, this , tr( "HP 48" ) ),
75 m_lpTypeModel( 0,0,2, this, tr( "low pass type" ) ) ,
76 m_hpTypeModel( 0,0,2, this, tr( "high pass type" ) ),
77 m_analyseInModel( true, this , tr( "Analyse IN" ) ),
78 m_analyseOutModel( true, this, tr( "Analyse OUT" ) )
79 {
80 m_hpFeqModel.setScaleLogarithmic( true );
81 m_lowShelfFreqModel.setScaleLogarithmic( true );
82 m_para1FreqModel.setScaleLogarithmic( true );
83 m_para2FreqModel.setScaleLogarithmic( true );
84 m_para3FreqModel.setScaleLogarithmic( true );
85 m_para4FreqModel.setScaleLogarithmic( true );
86 m_highShelfFreqModel.setScaleLogarithmic( true );
87 m_lpFreqModel.setScaleLogarithmic( true );
88 m_para1GainModel.setScaleLogarithmic( true );
89 m_inPeakL = 0;
90 m_inPeakR = 0;
91 m_outPeakL = 0;
92 m_outPeakR = 0;
93 m_lowShelfPeakL = 0; m_lowShelfPeakR = 0;
94 m_para1PeakL = 0; m_para1PeakR = 0;
95 m_para2PeakL = 0; m_para2PeakR = 0;
96 m_para3PeakL = 0; m_para3PeakR = 0;
97 m_para4PeakL = 0; m_para4PeakR = 0;
98 m_highShelfPeakL = 0; m_highShelfPeakR = 0;
99 m_inProgress = false;
100 m_inGainModel.setScaleLogarithmic( true );
101 }
102
103
104
105
loadSettings(const QDomElement & _this)106 void EqControls::loadSettings( const QDomElement &_this )
107 {
108 m_inGainModel.loadSettings( _this, "Inputgain" );
109 m_outGainModel.loadSettings( _this, "Outputgain" );
110 m_lowShelfGainModel.loadSettings( _this , "Lowshelfgain" );
111 m_para1GainModel.loadSettings( _this, "Peak1gain" );
112 m_para2GainModel.loadSettings( _this, "Peak2gain" );
113 m_para3GainModel.loadSettings( _this, "Peak3gain" );
114 m_para4GainModel.loadSettings( _this, "Peak4gain" );
115 m_highShelfGainModel.loadSettings( _this , "HighShelfgain" );
116 m_hpResModel.loadSettings( _this ,"HPres" );
117 m_lowShelfResModel.loadSettings( _this, "LowShelfres" );
118 m_para1BwModel.loadSettings( _this ,"Peak1bw" );
119 m_para2BwModel.loadSettings( _this ,"Peak2bw" );
120 m_para3BwModel.loadSettings( _this ,"Peak3bw" );
121 m_para4BwModel.loadSettings( _this ,"Peak4bw" );
122 m_highShelfResModel.loadSettings( _this, "HighShelfres" );
123 m_lpResModel.loadSettings( _this, "LPres" );
124 m_hpFeqModel.loadSettings( _this, "HPfreq" );
125 m_lowShelfFreqModel.loadSettings( _this, "LowShelffreq" );
126 m_para1FreqModel.loadSettings( _this, "Peak1freq" );
127 m_para2FreqModel.loadSettings( _this, "Peak2freq" );
128 m_para3FreqModel.loadSettings( _this, "Peak3freq" );
129 m_para4FreqModel.loadSettings( _this, "Peak4freq" );
130 m_highShelfFreqModel.loadSettings( _this, "Highshelffreq" );
131 m_lpFreqModel.loadSettings( _this, "LPfreq" );
132 m_hpActiveModel.loadSettings( _this, "HPactive" );
133 m_lowShelfActiveModel.loadSettings( _this, "Lowshelfactive" );
134 m_para1ActiveModel.loadSettings( _this, "Peak1active" );
135 m_para2ActiveModel.loadSettings( _this, "Peak2active" );
136 m_para3ActiveModel.loadSettings( _this, "Peak3active" );
137 m_para4ActiveModel.loadSettings( _this, "Peak4active" );
138 m_highShelfActiveModel.loadSettings( _this, "Highshelfactive" );
139 m_lpActiveModel.loadSettings( _this, "LPactive" );
140 m_lp12Model.loadSettings( _this , "LP12" );
141 m_lp24Model.loadSettings( _this , "LP24" );
142 m_lp48Model.loadSettings( _this , "LP48" );
143 m_hp12Model.loadSettings( _this , "HP12" );
144 m_hp24Model.loadSettings( _this , "HP24" );
145 m_hp48Model.loadSettings( _this , "HP48" );
146 m_lpTypeModel.loadSettings( _this, "LP" );
147 m_hpTypeModel.loadSettings( _this, "HP" );
148 m_analyseInModel.loadSettings( _this, "AnalyseIn" );
149 m_analyseOutModel.loadSettings( _this, "AnalyseOut" );
150 }
151
createView()152 EffectControlDialog*EqControls::createView()
153 {
154 return new EqControlsDialog( this );
155 }
156
157
158
159
saveSettings(QDomDocument & doc,QDomElement & parent)160 void EqControls::saveSettings( QDomDocument &doc, QDomElement &parent )
161 {
162 m_inGainModel.saveSettings( doc, parent, "Inputgain" );
163 m_outGainModel.saveSettings( doc, parent, "Outputgain");
164 m_lowShelfGainModel.saveSettings( doc, parent , "Lowshelfgain" );
165 m_para1GainModel.saveSettings( doc, parent, "Peak1gain" );
166 m_para2GainModel.saveSettings( doc, parent, "Peak2gain" );
167 m_para3GainModel.saveSettings( doc, parent, "Peak3gain" );
168 m_para4GainModel.saveSettings( doc, parent, "Peak4gain" );
169 m_highShelfGainModel.saveSettings( doc, parent, "HighShelfgain" );
170 m_hpResModel.saveSettings( doc, parent ,"HPres" );
171 m_lowShelfResModel.saveSettings( doc, parent, "LowShelfres" );
172 m_para1BwModel.saveSettings( doc, parent,"Peak1bw" );
173 m_para2BwModel.saveSettings( doc, parent,"Peak2bw" );
174 m_para3BwModel.saveSettings( doc, parent,"Peak3bw" );
175 m_para4BwModel.saveSettings( doc, parent,"Peak4bw" );
176 m_highShelfResModel.saveSettings( doc, parent, "HighShelfres" );
177 m_lpResModel.saveSettings( doc, parent, "LPres" );
178 m_hpFeqModel.saveSettings( doc, parent, "HPfreq" );
179 m_lowShelfFreqModel.saveSettings( doc, parent, "LowShelffreq" );
180 m_para1FreqModel.saveSettings( doc, parent, "Peak1freq" );
181 m_para2FreqModel.saveSettings( doc, parent, "Peak2freq" );
182 m_para3FreqModel.saveSettings( doc, parent, "Peak3freq" );
183 m_para4FreqModel.saveSettings( doc, parent, "Peak4freq" );
184 m_highShelfFreqModel.saveSettings( doc, parent, "Highshelffreq" );
185 m_lpFreqModel.saveSettings( doc, parent, "LPfreq" );
186 m_hpActiveModel.saveSettings( doc, parent, "HPactive" );
187 m_lowShelfActiveModel.saveSettings( doc, parent, "Lowshelfactive" );
188 m_para1ActiveModel.saveSettings( doc, parent, "Peak1active" );
189 m_para2ActiveModel.saveSettings( doc, parent, "Peak2active" );
190 m_para3ActiveModel.saveSettings( doc, parent, "Peak3active" );
191 m_para4ActiveModel.saveSettings( doc, parent, "Peak4active" );
192 m_highShelfActiveModel.saveSettings( doc, parent, "Highshelfactive" );
193 m_lpActiveModel.saveSettings( doc, parent, "LPactive" );
194 m_lp12Model.saveSettings( doc, parent, "LP12" );
195 m_lp24Model.saveSettings( doc, parent, "LP24" );
196 m_lp48Model.saveSettings( doc, parent, "LP48" );
197 m_hp12Model.saveSettings( doc, parent, "HP12" );
198 m_hp24Model.saveSettings( doc, parent, "HP24" );
199 m_hp48Model.saveSettings( doc, parent, "HP48" );
200 m_lpTypeModel.saveSettings( doc, parent, "LP" );
201 m_hpTypeModel.saveSettings( doc, parent, "HP" );
202 m_analyseInModel.saveSettings( doc, parent, "AnalyseIn" );
203 m_analyseOutModel.saveSettings( doc, parent, "AnalyseOut" );
204 }
205