SynthLab SDK
filtermodule.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 {
95  class FilterModule : public SynthModule
96  {
97  public:
99  FilterModule(std::shared_ptr<MidiInputData> _midiInputData,
100  std::shared_ptr<FilterParameters> _parameters,
101  uint32_t blockSize = 64);
102  virtual ~FilterModule() {}
103 
105  virtual bool reset(double _sampleRate) override;
106  virtual bool update() override;
107  virtual bool render(uint32_t samplesToProcess = 1) override;
108  virtual bool doNoteOn(MIDINoteEvent& noteEvent) override;
109  virtual bool doNoteOff(MIDINoteEvent& noteEvent) override;
110 
112  std::shared_ptr<FilterParameters> getParameters() { return parameters; }
113 
114  protected:
116  std::shared_ptr<FilterParameters> parameters = nullptr;
117 
118  double sampleRate = 0.0;
119  double midiPitch = 0.0; // for keytrack
120 
121  // --- stereo filters and coefficients; see FX book
122  enum { vicLPF2, vicBPF2 };
123  BQAudioFilter filters[STEREO_CHANNELS]; // stereo pair of filters
124  enum { a0, a1, a2, b1, b2, c0, d0 };
125  };
126 
127 }
std::shared_ptr< FilterParameters > getParameters()
Definition: filtermodule.h:112
virtual bool doNoteOn(MIDINoteEvent &noteEvent) override
Perform note-on operations for the component.
Definition: filtermodule.cpp:249
virtual bool update() override
Updates object by applying GUI parameter and input modulations to the internal variables.
Definition: filtermodule.cpp:88
Definition: filtermodule.h:95
virtual bool render(uint32_t samplesToProcess=1) override
Processes audio from the input buffers to the output buffers.
Definition: filtermodule.cpp:222
Simple version of the AudioFilter object from Designing Audio Effects Plugins in C++ 2nd Ed...
Definition: synthbase.h:1954
Definition: addosccore.cpp:4
FilterModule(std::shared_ptr< MidiInputData > _midiInputData, std::shared_ptr< FilterParameters > _parameters, uint32_t blockSize=64)
Constructs Digitally Controlled Amplifier module.
Definition: filtermodule.cpp:26
Abstract base class that encapsulates functionality of a module; used with the Module-Core paradigm...
Definition: synthbase.h:1600
std::shared_ptr< FilterParameters > parameters
Definition: filtermodule.h:116
virtual bool doNoteOff(MIDINoteEvent &noteEvent) override
Perform note-off operations for the component; Here there is nothing to do.
Definition: filtermodule.cpp:263
virtual bool reset(double _sampleRate) override
Resets object to initialized state.
Definition: filtermodule.cpp:66
hard-coded arrays of FIR filter coefficients for the sample rate conversion objects (Interpolator and...
Information about a MIDI note event (note on or note off).
Definition: synthstructures.h:212
See also Designing Software Synthesizers in C++ 2nd Ed. by Will Pirkle.