MostlyHarmless 0.0.1
 
Loading...
Searching...
No Matches
marvin_SVF.h
Go to the documentation of this file.
1// ========================================================================================================
2// _______ _______ ______ ___ ___ _______ _______
3// | | | _ | __ \ | |_ _| | |
4// | | | < | |_| |_| |
5// |__|_|__|___|___|___|__|\_____/|_______|__|____|
6//
7// This file is part of the Marvin open source library and is licensed under the terms of the MIT License.
8//
9// ========================================================================================================
10
11#ifndef MARVIN_SVF_H
12#define MARVIN_SVF_H
13
22 template <FloatType SampleType>
23 struct SVFResult {
24 SampleType highpass;
25 SampleType bandpass;
26 SampleType lowpass;
28 SampleType bandShelf;
29 SampleType lowShelf;
30 SampleType highShelf;
31 SampleType notch;
32 SampleType allpass;
33 };
34
38 template <FloatType SampleType>
39 class SVF {
40 public:
55
60 void initialise(double sampleRate);
61
66 void setFrequency(SampleType newFrequency);
67
72 void setResonance(SampleType newResonance);
73
78 void setGainDb(SampleType newGainDb);
79
85 [[nodiscard]] SVFResult<SampleType> operator()(SampleType x);
86
93 [[nodiscard]] SampleType operator()(FilterType type, SampleType x);
94
98 void reset();
99
100 private:
101 double m_sampleRate;
102 SampleType m_g;
103 SampleType m_R;
104 SampleType m_k{ static_cast<SampleType>(0.0) };
105 SampleType m_s1{ static_cast<SampleType>(0.0) };
106 SampleType m_s2{ static_cast<SampleType>(0.0) };
107 };
108} // namespace marvin::dsp::filters
109
110#endif
A TPT State Variable Filter, based on the structure from Vadim Zavalishin's The Art of VA Filter Desi...
Definition marvin_SVF.h:39
void initialise(double sampleRate)
FilterType
Definition marvin_SVF.h:44
@ LowShelf
Definition marvin_SVF.h:50
@ Highpass
Definition marvin_SVF.h:45
@ Bandpass
Definition marvin_SVF.h:46
@ BandShelf
Definition marvin_SVF.h:49
@ Lowpass
Definition marvin_SVF.h:47
@ Notch
Definition marvin_SVF.h:52
@ HighShelf
Definition marvin_SVF.h:51
@ NormalisedBandpass
Definition marvin_SVF.h:48
@ Allpass
Definition marvin_SVF.h:53
void setGainDb(SampleType newGainDb)
SampleType operator()(FilterType type, SampleType x)
void setFrequency(SampleType newFrequency)
SVFResult< SampleType > operator()(SampleType x)
void setResonance(SampleType newResonance)
Digital filter functions and classes.
Definition marvin_SVF.h:15
POD Struct containing the results from a tick on an instance of an SVF.
Definition marvin_SVF.h:23
SampleType bandShelf
Definition marvin_SVF.h:28
SampleType allpass
Definition marvin_SVF.h:32
SampleType lowpass
Definition marvin_SVF.h:26
SampleType highShelf
Definition marvin_SVF.h:30
SampleType notch
Definition marvin_SVF.h:31
SampleType lowShelf
Definition marvin_SVF.h:29
SampleType bandpass
Definition marvin_SVF.h:25
SampleType normalisedBandpass
Definition marvin_SVF.h:27
SampleType highpass
Definition marvin_SVF.h:24