1
/*******************************************/
2
/* PRCRev, a simple reverb unit */
3
/* by Perry Cook, 1996. */
4
/* Incorporated into the Reverb superclass */
5
/* by Gary Scavone, 1998. */
7
/* This is based on some of the famous */
8
/* Stanford CCRMA reverbs (NRev, KipRev) */
9
/* all based on the the Chowning/Moorer/ */
10
/* Schroeder reverberators, which use */
11
/* networks of simple allpass and comb */
12
/* delay filters. This particular */
13
/* structure consists of 2 allpass units */
14
/* in series followed by 2 comb filters in */
16
/*******************************************/
20
PRCRev :: PRCRev(MY_FLOAT T60)
22
int lens[4]={353,1097,1777,2137};
23
double srscale = SRATE / 44100.0;
26
if (SRATE < 44100.0) {
28
val = (int) floor(srscale * lens[i]);
29
if ((val & 1) == 0) val++;
30
while (!this->isprime(val)) val += 2;
36
APdelayLine[i] = new DLineN(lens[i] + 2);
37
APdelayLine[i]->setDelay(lens[i]);
38
CdelayLine[i] = new DLineN(lens[i+2] + 2);
39
CdelayLine[i]->setDelay(lens[i+2]);
40
combCoeff[i] = pow(10,(-3 * lens[i+2] / (T60 * SRATE)));
43
allPassCoeff = (MY_FLOAT) 0.7;
44
effectMix = (MY_FLOAT) 0.5;
50
delete APdelayLine[0];
51
delete APdelayLine[1];
56
void PRCRev :: clear()
58
APdelayLine[0]->clear();
59
APdelayLine[1]->clear();
60
CdelayLine[0]->clear();
61
CdelayLine[1]->clear();
62
lastOutL = (MY_FLOAT) 0.0;
63
lastOutR = (MY_FLOAT) 0.0;
66
void PRCRev :: setEffectMix(MY_FLOAT mix)
71
MY_FLOAT PRCRev :: lastOutput()
73
return (lastOutL + lastOutR) * (MY_FLOAT) 0.5;
76
MY_FLOAT PRCRev :: lastOutputL()
81
MY_FLOAT PRCRev :: lastOutputR()
86
MY_FLOAT PRCRev :: tick(MY_FLOAT input)
88
MY_FLOAT temp,temp0,temp1,temp2,temp3;
90
temp = APdelayLine[0]->lastOut();
91
temp0 = allPassCoeff * temp;
93
APdelayLine[0]->tick(temp0);
94
temp0 = -(allPassCoeff * temp0) + temp;
96
temp = APdelayLine[1]->lastOut();
97
temp1 = allPassCoeff * temp;
99
APdelayLine[1]->tick(temp1);
100
temp1 = -(allPassCoeff * temp1) + temp;
102
temp2 = temp1 + (combCoeff[0] * CdelayLine[0]->lastOut());
103
temp3 = temp1 + (combCoeff[1] * CdelayLine[1]->lastOut());
105
lastOutL = effectMix * (CdelayLine[0]->tick(temp2));
106
lastOutR = effectMix * (CdelayLine[1]->tick(temp3));
107
temp = (MY_FLOAT) (1.0 - effectMix) * input;
111
return (lastOutL + lastOutR) * (MY_FLOAT) 0.5;