Add TAL-Reverb-II plugin to test
[juce-lv2.git] / tal-reverb-2-juce / src / Engine / TalEq.h
blob83fec4b8b333f9dd1fa78e2178cfc25ff6fe3c8f
1 /*
2 ==============================================================================
3 This file is part of Tal-Reverb by Patrick Kunz.
5 Copyright(c) 2005-2009 Patrick Kunz, TAL
6 Togu Audio Line, Inc.
7 http://kunz.corrupt.ch
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)
26 #define __TalEq_h
28 #include "HighShelf.h"
29 #include "LowShelf.h"
30 #include "PeakEq.h"
32 class TalEq
34 private:
35 HighShelf *highShelf;
36 LowShelf *lowShelf;
37 PeakEq *peakEq;
39 float lowShelfGain;
40 float highShelfGain;
42 float lowShelfFrequency;
43 float highShelfFrequency;
45 float peakFrequency;
46 float peakGain;
48 AudioUtils audioUtils;
50 public:
51 TalEq(float sampleRate)
53 initialize(sampleRate);
56 ~TalEq()
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);
96 lowShelfGain = 0.5f;
97 highShelfGain = 0.5f;
98 peakGain = 0.5f;
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
112 #endif