Pd++  0.01
A pure C++ implementation of Pure Data objects
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
RawFilters.h
1 /*
2  RawFilters.h
3  Pd++
4 
5  Created by Robert Esler on 11/3/14.
6  Copyright (c) 2014 Robert Esler. All rights reserved.
7 */
8 
9 /* Some of the code in Pd++ is Copyright (c) 1997-1999 Miller Puckette.
10  For information on usage and redistribution, and for a DISCLAIMER OF ALL
11  WARRANTIES, see the file, "LICENSE.txt," in this distribution.
12 */
13 
14 #ifndef __Pd____RawFilters__
15 #define __Pd____RawFilters__
16 
17 #include <string>
18 #include "PdMaster.h"
19 
20 namespace pd {
21 
22 
23 /*! \brief An abstract class for all of Pd's raw filters. */
24 
25 class RawFilter : public PdMaster {
26 
27 protected:
28  double lastValue = 0;
29  double lastReal = 0;
30  double lastImaginary = 0;
31 
32 
33 
34 public:
35  RawFilter();
36  ~RawFilter();
37  //! For real filters
38  virtual double perform(double, double)=0;
39  //! For complex filters
40  virtual complexOutput perform(double, double, double, double)=0;
41  //! For real filters
42  void set(double value) {lastValue = value;};
43  //! For complex filters
44  void set(double real, double imaginary) {lastReal = real; lastImaginary = imaginary;};
45  //! For all types
46  void clear() {lastValue = lastReal = lastImaginary = 0;};
47 
48 
49  void setLast(double last);
50  void setLastReal(double lastreal);
51  void setLastImaginary(double lastimag);
52 
53  double getLast() {return lastValue;};
54  double getLastReal() {return lastReal;};
55  double getLastImaginary() {return lastImaginary;};
56 
57 };
58 
59 /* Raw: Real Filters*/
60 
61 /*! \brief Raw real one pole filter. */
62 class RealPole : public RawFilter {
63 
64 public:
65  RealPole();
66  ~RealPole();
67  double perform(double, double);
68  std::string pdName = "rpole~";
69 
70 };
71 /*! \brief Raw real one zero filter. */
72 class RealZero : public RawFilter {
73 
74 public:
75  RealZero();
76  ~RealZero();
77  double perform(double, double);
78  std::string pdName = "rzero~";
79 
80 };
81 /*! \brief Raw real reverse one zero filter. */
82 class RealZeroReverse : public RawFilter {
83 
84 public:
86  ~RealZeroReverse();
87  double perform(double, double);
88  std::string pdName = "rzero_rev~";
89 };
90 
91 /*Raw: Complex Filters*/
92 /*! \brief Raw complex one pole filter. */
93 class ComplexPole : public RawFilter {
94 
95 public:
96  ComplexPole();
97  ~ComplexPole();
98  /*! The output of this function is a struct with real and imag parts. */
99  complexOutput perform(double, double, double, double);
100  std::string pdName = "cpole~";
101 
102 };
103 /*! \brief Raw complex one zero filter. */
104 class ComplexZero : public RawFilter {
105 
106 public:
107  ComplexZero();
108  ~ComplexZero();
109  /*! The output of this function is a struct with real and imag parts. */
110  complexOutput perform(double, double, double, double);
111  std::string pdName = "czero~";
112 
113 };
114 /*! \brief Raw complex reverse one zero filter. */
116 
117 public:
120  /*! The output of this function is a struct with real and imag parts. */
121  complexOutput perform(double, double, double, double);
122  std::string pdName = "czero_rev~";
123 };
124 
125 } // pd namespace
126 #endif /* defined(__Pd____RawFilters__) */
Raw real reverse one zero filter.
Definition: RawFilters.h:82
The Pd++ namespace.
Definition: BandPass.cpp:14
double perform(double, double)
For real filters.
Definition: RawFilters.cpp:56
Raw complex one pole filter.
Definition: RawFilters.h:93
complexOutput perform(double, double, double, double)
Definition: RawFilters.cpp:147
ComplexPole()
Complex one pole filter.
Definition: RawFilters.cpp:101
A super class inherited by all Pd++ objects.
Definition: PdMaster.h:62
RealZeroReverse()
Real, reverse one zero filter.
Definition: RawFilters.cpp:74
Raw real one pole filter.
Definition: RawFilters.h:62
void set(double value)
For real filters.
Definition: RawFilters.h:42
ComplexZero()
Complex one zero filter.
Definition: RawFilters.cpp:139
virtual double perform(double, double)=0
For real filters.
void set(double real, double imaginary)
For complex filters.
Definition: RawFilters.h:44
An abstract class for all of Pd's raw filters.
Definition: RawFilters.h:25
ComplexZeroReverse()
Complex, reverse one zero filter.
Definition: RawFilters.cpp:174
double perform(double, double)
For real filters.
Definition: RawFilters.cpp:82
RealPole()
Real one pole filter.
Definition: RawFilters.cpp:22
double perform(double, double)
For real filters.
Definition: RawFilters.cpp:30
Raw complex reverse one zero filter.
Definition: RawFilters.h:115
Raw complex one zero filter.
Definition: RawFilters.h:104
complexOutput perform(double, double, double, double)
Definition: RawFilters.cpp:109
complexOutput perform(double, double, double, double)
Definition: RawFilters.cpp:182
A struct returned by complex filters.
Definition: PdMaster.h:55
RealZero()
Real one zero filter.
Definition: RawFilters.cpp:48
void clear()
For all types.
Definition: RawFilters.h:46
Raw real one zero filter.
Definition: RawFilters.h:72