Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
BandPass.h
1 /*
2  BandPass.cpp
3  Pd++
4 
5  Created by Robert Esler on 10/18/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____BandPass__
14 #define __Pd____BandPass__
15 
16 #include <string>
17 #include "PdMaster.h"
18 
19 
20 namespace pd {
21 
22 /*! \brief Band pass filter.
23 
24  Use setCenterFrequency() to adjust center freq. Use SetQ() to
25  set the Q or bandwidth of the filter.
26  If you want to use a signal or LFO to adjust either the Q or C(f) then look at
27  the VoltageControlFilter class.
28 
29 */
30 
31 class BandPass : public PdMaster {
32 
33 private:
34  typedef struct bpctl
35  {
36  double c_x1;
37  double c_x2;
38  double c_coef1;
39  double c_coef2;
40  double c_gain;
41  } t_bpctl;
42 
43  typedef struct sigbp
44  {
45  double x_sr;
46  double x_freq;
47  double x_q;
48  t_bpctl x_cspace;
49  t_bpctl *x_ctl;
50  double x_f;
51  } t_sigbp;
52  double sigbp_qcos(double f);
53  void sigbp_docoef(double cf, double q);
54 
55  t_sigbp *x = new t_sigbp;
56 
57 public:
58  BandPass();
59  BandPass(double cf, double q);
60  ~BandPass();
61  double perform(double input);
62  void setCenterFrequency(double cf);
63  void setQ(double q);
64  void clear();
65 
66  std::string pdName = "bp~";
67 };
68 
69 
70 } // pd namespace
71 
72 #endif /* defined(__Pd____BandPass__) */
The Pd++ namespace.
Definition: BandPass.cpp:14
A super class inherited by all Pd++ objects.
Definition: PdMaster.h:62
Band pass filter.
Definition: BandPass.h:31