Deluge Firmware
1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
svf.h
1
/*
2
* Copyright © 2015-2023 Synthstrom Audible Limited
3
*
4
* This file is part of The Synthstrom Audible Deluge Firmware.
5
*
6
* The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
7
* terms of the GNU General Public License as published by the Free Software Foundation,
8
* either version 3 of the License, or (at your option) any later version.
9
*
10
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
11
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License along with this program.
15
* If not, see <https://www.gnu.org/licenses/>.
16
*/
17
18
#pragma once
19
20
#include "dsp/filter/filter.h"
21
#include "util/fixedpoint.h"
22
23
namespace
deluge::dsp::filter {
24
25
class
SVFilter :
public
Filter<SVFilter> {
26
public
:
27
SVFilter() =
default
;
28
// returns a compensatory gain value
29
q31_t setConfig(q31_t hpfFrequency, q31_t hpfResonance, FilterMode lpfMode, q31_t lpfMorph, q31_t filterGain);
30
void
doFilter(q31_t* startSample, q31_t* endSample, int32_t sampleIncrememt);
31
void
doFilterStereo(q31_t* startSample, q31_t* endSample);
32
void
resetFilter() {
33
l = (
SVFState
){0, 0};
34
r = (
SVFState
){0, 0};
35
}
36
37
private
:
38
struct
SVFState
{
39
q31_t low;
40
q31_t band;
41
};
42
[[gnu::always_inline]]
inline
q31_t doSVF(q31_t input,
SVFState
& state);
43
SVFState
l;
44
SVFState
r;
45
46
q31_t q;
47
q31_t in;
48
q31_t c_low;
49
q31_t c_band;
50
q31_t c_notch;
51
q31_t c_high;
52
bool
band_mode;
53
};
54
}
// namespace deluge::dsp::filter
deluge::dsp::filter::SVFilter::SVFState
Definition
svf.h:38