Arduino STK 4.6.2
FreeVerb.h
1#ifndef STK_FREEVERB_H
2#define STK_FREEVERB_H
3
4#include "Effect.h"
5#include "Delay.h"
6#include "OnePole.h"
7
8namespace stk {
9
10/***********************************************************************/
24/***********************************************************************/
25
26class FreeVerb : public Effect
27{
28 public:
30
37
40
42 void setEffectMix( StkFloat mix );
43
45 void setRoomSize( StkFloat value );
46
48 StkFloat getRoomSize( void );
49
51 void setDamping( StkFloat value );
52
54 StkFloat getDamping( void );
55
57 void setWidth( StkFloat value );
58
60 StkFloat getWidth( void );
61
63 void setMode( bool isFrozen );
64
66 StkFloat getMode( void );
67
69 void clear( void );
70
72
80 StkFloat lastOut( unsigned int channel = 0 );
81
83
90 StkFloat tick( StkFloat inputL, StkFloat inputR = 0.0, unsigned int channel = 0 );
91
93
103 StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
104
106
117 StkFrames& tick( StkFrames& iFrames, StkFrames &oFrames, unsigned int iChannel = 0, unsigned int oChannel = 0 );
118
120 StkFloat tick( StkFloat input, unsigned int channel ) override {
121 return tick(input, 0.0, channel);
122 }
123
124
125 protected:
127 void update( void );
128
129 // Clamp very small floats to zero, version from
130 // http://music.columbia.edu/pipermail/linux-audio-user/2004-July/013489.html .
131 // However, this is for 32-bit floats only.
132 //static inline StkFloat undenormalize( volatile StkFloat s ) {
133 // s += 9.8607615E-32f;
134 // return s - 9.8607615E-32f;
135 //}
136
137 static const int nCombs = 8;
138 static const int nAllpasses = 4;
139 static const int stereoSpread = 23;
140 static const StkFloat fixedGain;
141 static const StkFloat scaleWet;
142 static const StkFloat scaleDry;
143 static const StkFloat scaleDamp;
144 static const StkFloat scaleRoom;
145 static const StkFloat offsetRoom;
146
147 // Delay line lengths for 44100Hz sampling rate.
148 static int cDelayLengths[nCombs];
149 static int aDelayLengths[nAllpasses];
150
151 StkFloat g_; // allpass coefficient
152 StkFloat gain_;
153 StkFloat roomSizeMem_, roomSize_;
154 StkFloat dampMem_, damp_;
155 StkFloat wet1_, wet2_;
156 StkFloat dry_;
157 StkFloat width_;
158 bool frozenMode_;
159
160 // LBFC: Lowpass Feedback Comb Filters
161 Delay combDelayL_[nCombs];
162 Delay combDelayR_[nCombs];
163 OnePole combLPL_[nCombs];
164 OnePole combLPR_[nCombs];
165
166 // AP: Allpass Filters
167 Delay allPassDelayL_[nAllpasses];
168 Delay allPassDelayR_[nAllpasses];
169};
170
171
172
173}
174
175#endif
STK non-interpolating delay line class.
Definition Delay.h:25
Effect(void)
Class constructor.
Definition Effect.h:25
StkFloat tick(StkFloat inputL, StkFloat inputR=0.0, unsigned int channel=0)
Input one or two samples to the effect and return the specified channel value of the computed stereo ...
~FreeVerb()
Destructor.
void clear(void)
Clears delay lines, etc.
void update(void)
Update interdependent parameters.
StkFrames & tick(StkFrames &frames, unsigned int channel=0)
Take two channels of the StkFrames object as inputs to the effect and replace with stereo outputs.
StkFloat getDamping(void)
Get the damping parameter.
void setRoomSize(StkFloat value)
Set the room size (comb filter feedback gain) parameter [0,1].
StkFloat getMode(void)
Get the current freeze mode [frozen = 1, unfrozen = 0].
void setWidth(StkFloat value)
Set the width (left-right mixing) parameter [0,1].
void setDamping(StkFloat value)
Set the damping parameter [0=low damping, 1=higher damping].
StkFrames & tick(StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0)
Take one or two channels of the iFrames object as inputs to the effect and write stereo outputs to th...
StkFloat lastOut(unsigned int channel=0)
Return the specified channel value of the last computed stereo frame.
FreeVerb()
FreeVerb Constructor.
StkFloat getWidth(void)
Get the width (left-right mixing) parameter.
StkFloat tick(StkFloat input, unsigned int channel) override
Input one sample to the effect and return the specified channel value of the computed mono frame.
Definition FreeVerb.h:120
void setMode(bool isFrozen)
Set the mode [frozen = 1, unfrozen = 0].
void setEffectMix(StkFloat mix)
Set the effect mix [0 = mostly dry, 1 = mostly wet].
StkFloat getRoomSize(void)
Get the room size (comb filter feedback gain) parameter.
STK one-pole filter class.
Definition OnePole.h:21
An STK class to handle vectorized audio data.
Definition Stk.h:287
The STK namespace.
Definition ADSR.h:8