~ubuntu-branches/ubuntu/breezy/muse/breezy

« back to all changes in this revision

Viewing changes to synti/stklib/Modulatr.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
 
/*  Modulator Class, Perry R. Cook, 1995-96*/ 
3
 
/*  This Object combines random and        */
4
 
/*  periodic modulations to give a nice    */
5
 
/*  natural human modulation function.     */  
6
 
/*******************************************/
7
 
 
8
 
#define POLE_POS  (MY_FLOAT) 0.999
9
 
#define RND_SCALE (MY_FLOAT) 10.0
10
 
 
11
 
#include "Modulatr.h"
12
 
 
13
 
Modulatr :: Modulatr()
14
 
{
15
 
  // Concatenate the STK RAWWAVE_PATH to the rawwave file
16
 
  char file[128];
17
 
  strcpy(file, RAWWAVE_PATH);
18
 
  vibwave = new RawWvIn(strcat(file,"rawwaves/sinewave.raw"),"looping");
19
 
  vibwave->setFreq((MY_FLOAT) 6.0);
20
 
  vibAmt = (MY_FLOAT)  0.04;
21
 
  noise = new SubNoise(330);
22
 
  rndAmt = (MY_FLOAT)  0.005;
23
 
  onepole = new OnePole;
24
 
  onepole->setPole(POLE_POS);
25
 
  onepole->setGain(rndAmt * RND_SCALE);
26
 
}
27
 
 
28
 
Modulatr :: ~Modulatr()
29
 
{
30
 
  delete vibwave;
31
 
  delete noise;
32
 
  delete onepole;
33
 
}
34
 
 
35
 
void Modulatr :: reset()
36
 
{
37
 
  lastOutput = (MY_FLOAT)  0.0;
38
 
}
39
 
 
40
 
void Modulatr :: setVibFreq(MY_FLOAT vibFreq)
41
 
{
42
 
  vibwave->setFreq(vibFreq);
43
 
}
44
 
 
45
 
void Modulatr :: setVibAmt(MY_FLOAT vibAmount)
46
 
{
47
 
  vibAmt = vibAmount;
48
 
}
49
 
 
50
 
void Modulatr :: setRndAmt(MY_FLOAT rndAmount)
51
 
{
52
 
  rndAmt = rndAmount;
53
 
  onepole->setGain(RND_SCALE * rndAmt);
54
 
}
55
 
 
56
 
MY_FLOAT Modulatr ::  tick()
57
 
{
58
 
  lastOutput = vibAmt * vibwave->tick();       /*  Compute periodic and */
59
 
  lastOutput += onepole->tick(noise->tick());  /*   random modulations  */
60
 
  return lastOutput;                        
61
 
}
62
 
 
63
 
MY_FLOAT Modulatr :: lastOut()
64
 
{
65
 
  return lastOutput;
66
 
}
67
 
 
68
 
/************   Test Main Program   *****************/
69
 
/*
70
 
void main()
71
 
{
72
 
    Modulatr testMod;
73
 
    FILE *fd;
74
 
    short data;
75
 
    long i;
76
 
    
77
 
    fd = fopen("test.raw","wb");
78
 
    
79
 
    for (i=0;i<20000;i++) {
80
 
        data = testMod.tick() * 32000.0;
81
 
        fwrite(&data,2,1,fd);
82
 
    }
83
 
    fclose(fd);
84
 
}
85
 
*/