~ubuntu-branches/ubuntu/raring/muse/raring-proposed

« back to all changes in this revision

Viewing changes to synti/stklib/BeeThree.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Kobras
  • Date: 2004-02-07 15:18:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040207151822-es27xxkzbcxkebjm
Tags: 0.6.3-1
* New upstream version.
* Added patches:
  + [10_alsa_init_fix] New, from upstream CVS.
    Initialize direction variable when setting Alsa parameters.
  + [10_canvas_translation_fix] New, from upstream CVS.
    Do not translate tooltips twice in canvas popup.
  + [10_checkbox_fix] New, from upstream CVS.
    Use proper set/test methods on metronome checkboxes.
  + [10_html_doc_cleanup] New.
    Fix links and HTML errors in documentation.
  + [20_allow_system_timer] New.
    The new upstream version fails by default if the real-time clock
    could not be accessed (usually the case when not running suid-root).
    This patch reverts the old behaviour of falling back to the more
    inaccurate system timer.
* Updated patches:
  + [11_PIC_fixes_fixup] Rediffed.
* Removed patches:
  + [20_no_atomic_asm] Merged upstream.
* debian/compat: Splice out debhelper compatibility level from rules file.
* debian/control: Build-depend on latest jack release by default.
  Closes: #228788
* debian/control: Bump standards version.
* debian/control: Use auto-generated debconf dependency via misc:Depends.
* debian/control: Minor tweaks to the long description.
* debian/control: Tighten fluidsynth build dependency to sane version.
* debian/muse.doc-base: New. Register HTML documentation with doc-base.
* debian/templates: Tiny rewording, and typo fix.
* debian/templates, debian/po/*: Switch to po-debconf for translations.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/******************************************/
2
 
/*  Hammond(OID) Organ Subclass           */
3
 
/*  of Algorithm 8 (TX81Z) Subclass of    */ 
4
 
/*  4 Operator FM Synth                   */
5
 
/*  by Perry R. Cook, 1995-96             */ 
6
 
/******************************************/
7
 
 
8
 
#include "BeeThree.h"
9
 
 
10
 
BeeThree :: BeeThree() : FM4Alg8()
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) 0.999);
27
 
  this->setRatio(1,(MY_FLOAT) 1.997);
28
 
  this->setRatio(2,(MY_FLOAT) 3.006);
29
 
  this->setRatio(3,(MY_FLOAT) 6.009);
30
 
  gains[0] = __FM4Op_gains[95];
31
 
  gains[1] = __FM4Op_gains[95];
32
 
  gains[2] = __FM4Op_gains[99];
33
 
  gains[3] = __FM4Op_gains[95];
34
 
  adsr[0]->setAllTimes((MY_FLOAT) 0.005,(MY_FLOAT) 0.003,(MY_FLOAT) 1.0,(MY_FLOAT) 0.01);
35
 
  adsr[1]->setAllTimes((MY_FLOAT) 0.005,(MY_FLOAT) 0.003,(MY_FLOAT) 1.0,(MY_FLOAT) 0.01);
36
 
  adsr[2]->setAllTimes((MY_FLOAT) 0.005,(MY_FLOAT) 0.003,(MY_FLOAT) 1.0,(MY_FLOAT) 0.01);
37
 
  adsr[3]->setAllTimes((MY_FLOAT) 0.005,(MY_FLOAT) 0.001,(MY_FLOAT) 0.4,(MY_FLOAT) 0.03);
38
 
  twozero->setGain((MY_FLOAT) 0.1);
39
 
40
 
 
41
 
BeeThree :: ~BeeThree()
42
 
{
43
 
 
44
 
}
45
 
 
46
 
void BeeThree :: setFreq(MY_FLOAT frequency)
47
 
{    
48
 
    baseFreq = frequency;
49
 
    waves[0]->setFreq(baseFreq * ratios[0]);
50
 
    waves[1]->setFreq(baseFreq * ratios[1]);
51
 
    waves[2]->setFreq(baseFreq * ratios[2]);
52
 
    waves[3]->setFreq(baseFreq * ratios[3]);
53
 
}
54
 
 
55
 
MY_FLOAT BeeThree :: tick()
56
 
{
57
 
    MY_FLOAT temp;
58
 
    if (modDepth > 0.0) {
59
 
        temp = (MY_FLOAT) 1.0 + (modDepth * vibWave->tick() * (MY_FLOAT) 0.1);
60
 
        waves[0]->setFreq(baseFreq * ratios[0] * temp);
61
 
        waves[1]->setFreq(baseFreq * ratios[1] * temp);
62
 
        waves[2]->setFreq(baseFreq * ratios[2] * temp);
63
 
        waves[3]->setFreq(baseFreq * ratios[3] * temp);
64
 
    }
65
 
    lastOutput = FM4Alg8 :: tick();
66
 
    return lastOutput;
67
 
}
68
 
 
69
 
void BeeThree :: noteOn(MY_FLOAT freq, MY_FLOAT amp)
70
 
{
71
 
    gains[0] = amp * __FM4Op_gains[95];
72
 
    gains[1] = amp * __FM4Op_gains[95];
73
 
    gains[2] = amp * __FM4Op_gains[99];
74
 
    gains[3] = amp * __FM4Op_gains[95];
75
 
    this->setFreq(freq);
76
 
    this->keyOn();
77
 
#if defined(_debug_)        
78
 
    printf("BeeThree : NoteOn: Freq=%lf Amp=%lf\n",freq,amp);
79
 
#endif    
80
 
}
81