~ubuntu-branches/ubuntu/quantal/muse/quantal

« back to all changes in this revision

Viewing changes to synti/stklib/Wurley.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2002-04-23 17:28:23 UTC
  • Revision ID: james.westby@ubuntu.com-20020423172823-w8yplzr81a759xa3
Tags: upstream-0.5.2
ImportĀ upstreamĀ versionĀ 0.5.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************/
 
2
/*  Wurlitzer Electric Piano Subclass     */
 
3
/*  of Algorithm 5 (TX81Z) Subclass of    */ 
 
4
/*  4 Operator FM Synth                   */
 
5
/*  by Perry R. Cook, 1995-96             */ 
 
6
/******************************************/
 
7
 
 
8
#include "Wurley.h"
 
9
 
 
10
Wurley :: Wurley() : FM4Alg5()
 
11
{
 
12
  // Concatenate the STK RAWWAVE_PATH to the rawwave file
 
13
  char file1[128];
 
14
  char file2[128];
 
15
  char file3[128];
 
16
  char file4[128];
 
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
    
 
26
  this->setRatio(0,(MY_FLOAT) 1.0);
 
27
  this->setRatio(1,(MY_FLOAT) 4.0);
 
28
  this->setRatio(2,(MY_FLOAT) -510.0);
 
29
  this->setRatio(3,(MY_FLOAT) -510.0);
 
30
  gains[0] = __FM4Op_gains[99];
 
31
  gains[1] = __FM4Op_gains[82];
 
32
  gains[2] = __FM4Op_gains[92];
 
33
  gains[3] = __FM4Op_gains[68];   /* Originally 78, but sounded stinky */
 
34
  twozero->setGain((MY_FLOAT)  2.0);
 
35
  adsr[0]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 1.50,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
 
36
  adsr[1]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 1.50,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
 
37
  adsr[2]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 0.25,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
 
38
  adsr[3]->setAllTimes((MY_FLOAT) 0.001,(MY_FLOAT) 0.15,(MY_FLOAT) 0.0,(MY_FLOAT) 0.04);
 
39
  vibWave->setFreq((MY_FLOAT) 8.0);
 
40
}  
 
41
 
 
42
void Wurley :: setFreq(MY_FLOAT frequency)
 
43
{    
 
44
    baseFreq = frequency;
 
45
    waves[0]->setFreq(baseFreq * ratios[0]);
 
46
    waves[1]->setFreq(baseFreq * ratios[1]);
 
47
    waves[2]->setFreq(ratios[2]);       /* Note here a 'fixed resonance' */
 
48
    waves[3]->setFreq(ratios[3]);
 
49
}
 
50
 
 
51
void Wurley :: noteOn(MY_FLOAT freq, MY_FLOAT amp)
 
52
{
 
53
    gains[0] = amp * __FM4Op_gains[99];
 
54
    gains[1] = amp * __FM4Op_gains[82];
 
55
    gains[2] = amp * __FM4Op_gains[82];      /*   Originally 92 */
 
56
    gains[3] = amp * __FM4Op_gains[68];      /*   Originally 78 */
 
57
    this->setFreq(freq);
 
58
    this->keyOn();
 
59
#if defined(_debug_)        
 
60
    printf("Wurley : NoteOn: Freq=%lf Amp=%lf\n",freq,amp);
 
61
#endif    
 
62
}