2 ==============================================================================
3 This file is part of Tal-Reverb by Patrick Kunz.
5 Copyright(c) 2005-2009 Patrick Kunz, TAL
9 This file may be licensed under the terms of of the
10 GNU General Public License Version 2 (the ``GPL'').
12 Software distributed under the License is distributed
13 on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
14 express or implied. See the GPL for the specific language
15 governing rights and limitations.
17 You should have received a copy of the GPL along with this
18 program. If not, go to http://www.gnu.org/licenses/gpl.html
19 or write to the Free Software Foundation, Inc.,
20 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 ==============================================================================
25 #if !defined(__TalEq_h)
28 #include "HighShelf.h"
42 float lowShelfFrequency
;
43 float highShelfFrequency
;
48 AudioUtils audioUtils
;
51 TalEq(float sampleRate
)
53 initialize(sampleRate
);
60 void setLowShelfGain(float lowShelfGain
)
62 this->lowShelfGain
= lowShelfGain
* 0.5f
;
65 void setHighShelfGain(float highShelfGain
)
67 this->highShelfGain
= highShelfGain
* 0.5f
;
70 void setPeakGain(float peakGain
)
72 this->peakGain
= peakGain
* 0.5f
;
75 void setLowShelfFrequency(float lowShelfFrequency
)
77 this->lowShelfFrequency
= audioUtils
.getLogScaledFrequency(lowShelfFrequency
);
80 void setHighShelfFrequency(float highShelfFrequency
)
82 this->highShelfFrequency
= audioUtils
.getLogScaledFrequency(highShelfFrequency
);
85 void setPeakFrequency(float peakFrequency
)
87 this->peakFrequency
= audioUtils
.getLogScaledFrequency(peakFrequency
);
90 void initialize(float sampleRate
)
92 highShelf
= new HighShelf(sampleRate
, 18);
93 lowShelf
= new LowShelf(sampleRate
, 18);
94 peakEq
= new PeakEq(sampleRate
, 18);
100 lowShelfFrequency
= 1000.0f
;
101 highShelfFrequency
= 1000.0f
;
102 peakFrequency
= 1000.0f
;
105 void process(float *sample
)
107 highShelf
->tick(sample
, highShelfFrequency
, 1.05f
, highShelfGain
); // 0..0.5
108 lowShelf
->tick(sample
, lowShelfFrequency
, 1.05f
, lowShelfGain
); // 0..0.5
109 peakEq
->tick(sample
, peakFrequency
, 1.05f
, peakGain
); // 0..0.5