Deluge Firmware 1.3.0
Build date: 2025.04.16
Loading...
Searching...
No Matches
hpladder.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 "dsp/filter/ladder_components.h"
22#include "util/fixedpoint.h"
23
24namespace deluge::dsp::filter {
25
26class HpLadderFilter : public Filter<HpLadderFilter> {
27public:
28 HpLadderFilter() = default;
29 // returns a compensatory gain value
30 q31_t setConfig(q31_t hpfFrequency, q31_t hpfResonance, FilterMode lpfMode, q31_t lpfMorph, q31_t filterGain);
31 void doFilter(q31_t* startSample, q31_t* endSample, int32_t sampleIncrememt);
32 void doFilterStereo(q31_t* startSample, q31_t* endSample);
33 void resetFilter() {
34 l.reset();
35 r.reset();
36 }
37
38private:
43 uint32_t hpfLastWorkingValue;
44 void reset() {
45 hpfHPF1.reset();
46 hpfLPF1.reset();
47 hpfHPF3.reset();
48 }
49 };
50 [[gnu::always_inline]] inline q31_t doHPF(q31_t input, HPLadderState& state);
51
52 bool hpfDoingAntialiasingNow;
53 int32_t hpfDivideByTotalMoveabilityLastTime;
54 int32_t hpfDivideByProcessedResonanceLastTime;
55
56 // All feedbacks have 1 represented as 1073741824
57 q31_t hpfLPF1Feedback;
58 q31_t hpfHPF3Feedback;
59
60 q31_t hpfProcessedResonance; // 1 represented as 1073741824
61 bool hpfDoAntialiasing;
62 q31_t hpfDivideByProcessedResonance;
63
64 q31_t divideByTotalMoveability; // 1 represented as 268435456
65
66 q31_t alteredHpfMomentumMultiplier;
67 q31_t thisHpfResonance;
68 q31_t morph_;
71};
72} // namespace deluge::dsp::filter
Definition ladder_components.h:23