1
/******************************************/
2
/* Fender Rhodes Electric Piano Subclass */
3
/* of Algorithm 5 (TX81Z) Subclass of */
4
/* 4 Operator FM Synth */
5
/* by Perry R. Cook, 1995-96 */
6
/******************************************/
10
Rhodey :: Rhodey() : FM4Alg5()
12
// Concatenate the STK RAWWAVE_PATH to the rawwave file
17
strcpy(file1, RAWWAVE_PATH);
18
strcpy(file2, RAWWAVE_PATH);
19
strcpy(file3, RAWWAVE_PATH);
20
strcpy(file4, RAWWAVE_PATH);
21
this->loadWaves(strcat(file1,"rawwaves/sinewave.raw"),
22
strcat(file2,"rawwaves/sinewave.raw"),
23
strcat(file3,"rawwaves/sinewave.raw"),
24
strcat(file4,"rawwaves/fwavblnk.raw"));
25
this->setRatio(0,(MY_FLOAT) 1.0);
26
this->setRatio(1,(MY_FLOAT) 0.5);
27
this->setRatio(2,(MY_FLOAT) 1.0);
28
this->setRatio(3,(MY_FLOAT) 15.0);
29
gains[0] = __FM4Op_gains[99];
30
gains[1] = __FM4Op_gains[90];
31
gains[2] = __FM4Op_gains[99];
32
gains[3] = __FM4Op_gains[67];
33
adsr[0]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 1.50,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
34
adsr[1]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 1.50,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
35
adsr[2]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 1.00,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
36
adsr[3]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 0.25,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
37
twozero->setGain((MY_FLOAT) 1.0);
45
void Rhodey :: setFreq(MY_FLOAT frequency)
47
baseFreq = frequency * (MY_FLOAT) 2.0;
48
waves[0]->setFreq(baseFreq * ratios[0]);
49
waves[1]->setFreq(baseFreq * ratios[1]);
50
waves[2]->setFreq(baseFreq * ratios[2]);
51
waves[3]->setFreq(baseFreq * ratios[3]);
54
void Rhodey :: noteOn(MY_FLOAT freq, MY_FLOAT amp)
56
gains[0] = amp * __FM4Op_gains[99];
57
gains[1] = amp * __FM4Op_gains[90];
58
gains[2] = amp * __FM4Op_gains[99];
59
gains[3] = amp * __FM4Op_gains[67];
63
printf("Rhodey : NoteOn: Freq=%lf Amp=%lf\n",freq,amp);