openshot-audio  0.1.2
juce_IIRFilter.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission is granted to use this software under the terms of either:
8  a) the GPL v2 (or any later version)
9  b) the Affero GPL v3
10 
11  Details of these licenses can be found at: www.gnu.org/licenses
12 
13  JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
14  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15  A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 
17  ------------------------------------------------------------------------------
18 
19  To release a closed-source product which uses JUCE, commercial licenses are
20  available: visit www.juce.com for more information.
21 
22  ==============================================================================
23 */
24 
25 #ifndef JUCE_IIRFILTER_H_INCLUDED
26 #define JUCE_IIRFILTER_H_INCLUDED
27 
28 class IIRFilter;
29 
30 //==============================================================================
37 {
38 public:
39  //==============================================================================
42 
48  IIRCoefficients (double c1, double c2, double c3,
49  double c4, double c5, double c6) noexcept;
50 
54  IIRCoefficients& operator= (const IIRCoefficients&) noexcept;
57 
59  static IIRCoefficients makeLowPass (double sampleRate,
60  double frequency) noexcept;
61 
63  static IIRCoefficients makeHighPass (double sampleRate,
64  double frequency) noexcept;
65 
66  //==============================================================================
73  static IIRCoefficients makeLowShelf (double sampleRate,
74  double cutOffFrequency,
75  double Q,
76  float gainFactor) noexcept;
77 
84  static IIRCoefficients makeHighShelf (double sampleRate,
85  double cutOffFrequency,
86  double Q,
87  float gainFactor) noexcept;
88 
96  static IIRCoefficients makePeakFilter (double sampleRate,
97  double centreFrequency,
98  double Q,
99  float gainFactor) noexcept;
100 
101  //==============================================================================
105  float coefficients[5];
106 };
107 
108 //==============================================================================
116 {
117 public:
118  //==============================================================================
126 
128  IIRFilter (const IIRFilter&) noexcept;
129 
131  ~IIRFilter() noexcept;
132 
133  //==============================================================================
135  void makeInactive() noexcept;
136 
138  void setCoefficients (const IIRCoefficients& newCoefficients) noexcept;
139 
141  IIRCoefficients getCoefficients() const noexcept { return coefficients; }
142 
143  //==============================================================================
150  void reset() noexcept;
151 
153  void processSamples (float* samples, int numSamples) noexcept;
154 
160  float processSingleSampleRaw (float sample) noexcept;
161 
162 protected:
163  //==============================================================================
166  float v1, v2;
167  bool active;
168 
169  IIRFilter& operator= (const IIRFilter&);
171 };
172 
173 
174 #endif // JUCE_IIRFILTER_H_INCLUDED
#define noexcept
Definition: juce_CompilerSupport.h:141
Definition: juce_IIRFilter.h:115
SpinLock processLock
Definition: juce_IIRFilter.h:164
Definition: juce_SpinLock.h:46
IIRCoefficients getCoefficients() const noexcept
Definition: juce_IIRFilter.h:141
#define JUCE_API
Definition: juce_StandardHeader.h:139
float v2
Definition: juce_IIRFilter.h:166
#define const
bool active
Definition: juce_IIRFilter.h:167
IIRCoefficients coefficients
Definition: juce_IIRFilter.h:165
Definition: juce_IIRFilter.h:36
#define JUCE_LEAK_DETECTOR(OwnerClass)
Definition: juce_LeakedObjectDetector.h:141