1
// ----------------------------------------------------------------------------
3
// Copyright (C) 2006-2008 Fons Adriaensen <fons@linuxaudio.org>
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 2 of the License, or
8
// (at your option) any later version.
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
// ----------------------------------------------------------------------------
30
void PM_filt1::init (float w, float b, float g)
33
// if (g < 1.0f) b /= g; // Uncomment for +/- gain symmetry - NOT for TetraProc
35
_c1 = -cosf (P2F * w);
36
_c2 = (1 - b) / (1 + b);
40
void PM_filt1::init (PM_filt1& F)
48
void PM_filt1::process (int n, float *ip, float *op)
58
x -= _g * (z2 + _c2 * y - x);
70
void PM_filt2::init (float w1, float b1, float g1, float w2, float b2, float g2, float gc)
73
// if (g1 < 1.0f) b1 /= g1; // Uncomment for +/- gain symmetry - NOT for TetraProc
75
_c1 = -cosf (P2F * w1);
76
_c2 = (1 - b1) / (1 + b1);
78
// if (g2 < 1.0f) b2 /= g2; // Uncomment for +/- gain symmetry - NOT for TetraProc
80
_c3 = -cosf (P2F * w2);
81
_c4 = (1 - b2) / (1 + b2);
86
void PM_filt2::init (PM_filt2& F)
98
void PM_filt2::process (int n, float *ip, float *op)
100
float x, y, z1, z2, z3, z4;
110
x -= _g1 * (z2 + _c2 * y - x);
115
x -= _g2 * (z4 + _c4 * y - x);