Add TAL-Reverb-II plugin to test
[juce-lv2.git] / tal-reverb-2-juce / src / Engine / ParamChangeUtil.h
blob68e42651f00cd0322a54c295c720729098a35ac7
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(__ParamChangeUtil_h)
26 #define __ParamChangeUtil_h
28 #include "Math.h"
30 // Low pass filter for gentle parameter changes
31 class ParamChangeUtil
33 private:
34 float currentValue;
35 float paramWeight;
36 float paramWeigthInverse;
38 public:
39 // param weight should be bigger than 1
40 ParamChangeUtil(float sampleRate, float paramWeight)
42 currentValue = 0;
43 this->paramWeight = paramWeight * sampleRate / 44100.0f;
44 paramWeigthInverse = 1.0f / (this->paramWeight + 1.0f);
47 inline float tick(float input)
49 currentValue = (paramWeight * currentValue + input) * paramWeigthInverse;
50 return currentValue;
53 #endif