Deluge Firmware
Loading...
Searching...
No Matches
revmodel.hpp
Go to the documentation of this file.
1// Reverb model declaration
2//
3// Written by Jezar at Dreampoint, June 2000
4// http://www.dreampoint.co.uk
5// This code is public domain
6
7/*
8 * Copyright © 2015-2023 Synthstrom Audible Limited
9 *
10 * This file is part of The Synthstrom Audible Deluge Firmware.
11 *
12 * The Synthstrom Audible Deluge Firmware is free software: you can redistribute it and/or modify it under the
13 * terms of the GNU General Public License as published by the Free Software Foundation,
14 * either version 3 of the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
17 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 * See the GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License along with this program.
21 * If not, see <https://www.gnu.org/licenses/>.
22 */
23
24#ifndef _revmodel_
25#define _revmodel_
26
27#include "comb.hpp"
28#include "allpass.hpp"
29#include "tuning.h"
30
32{
33public:
34 revmodel();
35 void mute();
36 //void process(int32_t input, int32_t *outputL, int32_t *outputR);
37 void setroomsize(float value);
38 float getroomsize();
39 void setdamp(float value);
40 float getdamp();
41 void setwet(float value);
42 float getwet();
43 void setdry(float value);
44 float getdry();
45 void setwidth(float value);
46 float getwidth();
47 void setmode(float value);
48 float getmode();
49
50
51 inline void process(int32_t input, int32_t *outputL, int32_t *outputR)
52 {
53 int32_t outL,outR;
54
55 outL = outR = 0;
56
57 // Accumulate comb filters in parallel
58 for(int i=0; i<numcombs; i++)
59 {
60 outL += combL[i].process(input);
61 outR += combR[i].process(input);
62 }
63
64 // Feed through allpasses in series
65 for(int i=0; i<numallpasses; i++)
66 {
67 outL = allpassL[i].process(outL);
68 outR = allpassR[i].process(outR);
69 }
70
71 // Calculate output
72 *outputL = outL + (multiply_32x32_rshift32_rounded(outR, wet2)) << 1;
73 *outputR = outR + (multiply_32x32_rshift32_rounded(outL, wet2)) << 1;
74 }
75private:
76 void update();
77private:
78 int32_t gain;
79 float roomsize;
80 float damp;
81 float wet;
82 float wet1;
83 int32_t wet2;
84 float dry;
85 float width;
86 float mode;
87
88 // The following are all declared inline
89 // to remove the need for dynamic allocation
90 // with its subsequent error-checking messiness
91
92 // Comb filters
93 comb combL[numcombs];
94 comb combR[numcombs];
95
96 // Allpass filters
97 allpass allpassL[numallpasses];
98 allpass allpassR[numallpasses];
99
100 // Buffers for the combs
101 int32_t bufcombL1[combtuningL1];
102 int32_t bufcombR1[combtuningR1];
103 int32_t bufcombL2[combtuningL2];
104 int32_t bufcombR2[combtuningR2];
105 int32_t bufcombL3[combtuningL3];
106 int32_t bufcombR3[combtuningR3];
107 int32_t bufcombL4[combtuningL4];
108 int32_t bufcombR4[combtuningR4];
109 int32_t bufcombL5[combtuningL5];
110 int32_t bufcombR5[combtuningR5];
111 int32_t bufcombL6[combtuningL6];
112 int32_t bufcombR6[combtuningR6];
113 int32_t bufcombL7[combtuningL7];
114 int32_t bufcombR7[combtuningR7];
115 int32_t bufcombL8[combtuningL8];
116 int32_t bufcombR8[combtuningR8];
117
118 // Buffers for the allpasses
119 int32_t bufallpassL1[allpasstuningL1];
120 int32_t bufallpassR1[allpasstuningR1];
121 int32_t bufallpassL2[allpasstuningL2];
122 int32_t bufallpassR2[allpasstuningR2];
123 int32_t bufallpassL3[allpasstuningL3];
124 int32_t bufallpassR3[allpasstuningR3];
125 int32_t bufallpassL4[allpasstuningL4];
126 int32_t bufallpassR4[allpasstuningR4];
127};
128
129#endif//_revmodel_
130
131//ends
Definition: allpass.hpp:30
int32_t process(int32_t inp)
Definition: allpass.hpp:47
Definition: comb.hpp:31
int32_t process(int32_t inp)
Definition: comb.hpp:54
Definition: revmodel.hpp:32
float getroomsize()
Definition: revmodel.cpp:129
void setdry(float value)
Definition: revmodel.cpp:156
void setmode(float value)
Definition: revmodel.cpp:177
float getdry()
Definition: revmodel.cpp:161
void setwet(float value)
Definition: revmodel.cpp:145
void mute()
Definition: revmodel.cpp:74
float getmode()
Definition: revmodel.cpp:183
void setwidth(float value)
Definition: revmodel.cpp:166
float getdamp()
Definition: revmodel.cpp:140
void process(int32_t input, int32_t *outputL, int32_t *outputR)
Definition: revmodel.hpp:51
float getwidth()
Definition: revmodel.cpp:172
void setroomsize(float value)
Definition: revmodel.cpp:123
revmodel()
Definition: revmodel.cpp:26
void setdamp(float value)
Definition: revmodel.cpp:134
float getwet()
Definition: revmodel.cpp:151
const int allpasstuningR4
Definition: tuning.h:73
const int combtuningR2
Definition: tuning.h:53
const int combtuningL1
Definition: tuning.h:50
const int combtuningR8
Definition: tuning.h:65
const int combtuningL7
Definition: tuning.h:62
const int combtuningL3
Definition: tuning.h:54
const int allpasstuningL3
Definition: tuning.h:70
const int numcombs
Definition: tuning.h:28
const int allpasstuningR2
Definition: tuning.h:69
const int combtuningL6
Definition: tuning.h:60
const int combtuningL2
Definition: tuning.h:52
const int combtuningR4
Definition: tuning.h:57
const int allpasstuningR3
Definition: tuning.h:71
const int allpasstuningL2
Definition: tuning.h:68
const int combtuningR6
Definition: tuning.h:61
const int combtuningR5
Definition: tuning.h:59
const int combtuningR7
Definition: tuning.h:63
const int allpasstuningL1
Definition: tuning.h:66
const int combtuningL8
Definition: tuning.h:64
const int numallpasses
Definition: tuning.h:29
const int allpasstuningL4
Definition: tuning.h:72
const int combtuningL5
Definition: tuning.h:58
const int combtuningL4
Definition: tuning.h:56
const int combtuningR1
Definition: tuning.h:51
const int combtuningR3
Definition: tuning.h:55
const int allpasstuningR1
Definition: tuning.h:67