SynthLab SDK
bqfiltercore.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "synthbase.h"
4 #include "synthfunctions.h"
5 
6 // -----------------------------
7 // --- SynthLab SDK File --- //
8 // ----------------------------
16 // -----------------------------------------------------------------------------
17 namespace SynthLab
18 {
80  class BQFilterCore : public ModuleCore
81  {
82  public:
84  BQFilterCore(); /* C-TOR */
85 
87  virtual ~BQFilterCore() {} /* D-TOR */
88 
90  virtual bool reset(CoreProcData& processInfo) override;
91  virtual bool update(CoreProcData& processInfo) override;
92  virtual bool render(CoreProcData& processInfo) override;
93  virtual bool doNoteOn(CoreProcData& processInfo) override;
94  virtual bool doNoteOff(CoreProcData& processInfo) override;
95 
97  void flushDelays()
98  {
99  for (uint32_t i = 0; i < STEREO_CHANNELS; i++)
100  filter[i].flushDelays();
101  }
102 
103  protected:
104  BQAudioFilter filter[STEREO_CHANNELS];
105  enum { a0, a1, a2, b1, b2, c0, d0 };
106  double sampleRate = 1.0;
107  double outputAmp = 1.0;
108  double midiPitch = 440.0;
109  };
110 
111 
112 
113 } // namespace
114 
BQAudioFilter filter[STEREO_CHANNELS]
biquad audio filter objects
Definition: bqfiltercore.h:104
virtual bool update(CoreProcData &processInfo) override
Updates the object for the next block of audio processing.
Definition: bqfiltercore.cpp:97
double sampleRate
fs
Definition: bqfiltercore.h:106
virtual bool doNoteOff(CoreProcData &processInfo) override
Note-off handler for the ModuleCore.
Definition: bqfiltercore.cpp:305
virtual bool reset(CoreProcData &processInfo) override
Resets object to initialized state.
Definition: bqfiltercore.cpp:70
Simple version of the AudioFilter object from Designing Audio Effects Plugins in C++ 2nd Ed...
Definition: synthbase.h:1954
Definition: addosccore.cpp:4
virtual bool render(CoreProcData &processInfo) override
Renders the output of the module.
Definition: bqfiltercore.cpp:231
void flushDelays()
Definition: bqfiltercore.h:97
Implements Filters via BiQuad structures; includes one pole HPF and LPF.
Definition: bqfiltercore.h:80
virtual bool doNoteOn(CoreProcData &processInfo) override
Note-on handler for the ModuleCore.
Definition: bqfiltercore.cpp:282
double outputAmp
output scaling
Definition: bqfiltercore.h:107
double midiPitch
midi note pitch
Definition: bqfiltercore.h:108
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
This structure holds all of the information needed to call functions on a ModuleCore object...
Definition: synthbase.h:1071
BQFilterCore()
Construction: Cores follow the same construction pattern.
Definition: bqfiltercore.cpp:31
Abstract base class that encapsulates functionality of a module core; used with the Module-Core parad...
Definition: synthbase.h:1516
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.
virtual ~BQFilterCore()
Definition: bqfiltercore.h:87