Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
BiQuad.h
1 /*
2  BiQuad2.cpp
3  Pd++
4 
5  Created by Esler,Robert Wadhams on 9/26/14.
6  Copyright (c) 2014 Robert Esler. All rights reserved.
7 
8  Some of the code in Pd++ is Copyright (c) 1997-1999 Miller Puckette.
9  For information on usage and redistribution, and for a DISCLAIMER OF ALL
10  WARRANTIES, see the file, "LICENSE.txt," in this distribution.
11  */
12 
13 #ifndef __Pd____BiQuad2__
14 #define __Pd____BiQuad2__
15 
16 #include <string>
17 #include "PdMaster.h"
18 #include <string>
19 
20 namespace pd {
21 
22 /*! \brief A two-pole, two-zero filter.
23 
24  Biquad takes a list of five parameters. The parameters in order are:
25  feedback1, feedback2, feedforward1, feedforward2, feedforward3.
26 
27 */
28 
29 class BiQuad : public PdMaster {
30 
31 private:
32 
33  typedef struct biquadctl
34  {
35  float c_x1=0;
36  float c_x2=0;
37  float c_fb1=0;
38  float c_fb2=0;
39  float c_ff1=0;
40  float c_ff2=0;
41  float c_ff3=0;
42  } t_biquadctl;
43 
44  typedef struct sigbiquad
45  {
46 
47  float x_f;
48  t_biquadctl x_cspace;
49  t_biquadctl *x_ctl;
50  } t_sigbiquad;
51 
52  /*prototypes and globals*/
53  t_sigbiquad *x = new t_sigbiquad;
54  int globalCounter = 0;
55  float last = 0;
56  float prev = 0;
57 
58  /*Used by setCoefficients()*/
59  void list(double fb1, double fb2, double ff1, double ff2, double ff3);
60 
61 public:
62  BiQuad();
63  ~BiQuad();
64  double perform(double );
65  void setCoefficients(double fb1, double fb2, double ff1, double ff2, double ff3);
66  void set(double a, double b);
67 
68  const std::string pdName = "biquad~";
69 };
70 
71 } // pd namespace
72 #endif /* defined(__Pd____BiQuad2__) */
A two-pole, two-zero filter.
Definition: BiQuad.h:29
The Pd++ namespace.
Definition: BandPass.cpp:14
A super class inherited by all Pd++ objects.
Definition: PdMaster.h:62