diff options
author | N.N. <sevyves@users.sourceforge.net> | 2004-11-14 22:47:29 +0000 |
---|---|---|
committer | N.N. <sevyves@users.sourceforge.net> | 2004-11-14 22:47:29 +0000 |
commit | e625413ae9b5cb00209ab406283fff0b622eb5a7 (patch) | |
tree | e6508406183c02497ab10060c08db61928ca8ed8 /stkdrone~/drone.cc | |
parent | 4c34104a8fb52d339b9f43f9b851e65698998408 (diff) |
adapted for STK 4.2.0
svn path=/trunk/externals/unauthorized/; revision=2271
Diffstat (limited to 'stkdrone~/drone.cc')
-rw-r--r-- | stkdrone~/drone.cc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/stkdrone~/drone.cc b/stkdrone~/drone.cc index ba065ad..dcc3137 100644 --- a/stkdrone~/drone.cc +++ b/stkdrone~/drone.cc @@ -9,12 +9,12 @@ #include "drone.h" -drone :: drone(MY_FLOAT lowestFreq) +drone :: drone(StkFloat lowestFreq) { length = (long) (SRATE / lowestFreq + 1); - loopGain = (MY_FLOAT) 0.999; + loopGain = (StkFloat) 0.999; loopFilt = new OneZero(); - delayLine = new DLineA(length); + delayLine = new DelayA(0.5*length, length); envelope = new ADSR(); noise = new Noise; envelope->setAllTimes(2.0,0.5,0.0,0.5); @@ -35,21 +35,21 @@ void drone :: clear() delayLine->clear(); } -void drone :: setFreq(MY_FLOAT frequency) +void drone :: setFreq(StkFloat frequency) { - MY_FLOAT delay; + StkFloat delay; delay = (SRATE / frequency); delayLine->setDelay(delay - 0.5); - loopGain = (MY_FLOAT) 0.997 + (frequency * (MY_FLOAT) 0.000002); - if (loopGain>1.0) loopGain = (MY_FLOAT) 0.99999; + loopGain = (StkFloat) 0.997 + (frequency * (StkFloat) 0.000002); + if (loopGain>1.0) loopGain = (StkFloat) 0.99999; } -void drone :: pluck(MY_FLOAT amplitude) +void drone :: pluck(StkFloat amplitude) { envelope->keyOn(); } -void drone :: noteOn(MY_FLOAT freq, MY_FLOAT amp) +void drone :: noteOn(StkFloat freq, StkFloat amp) { this->setFreq(freq); this->pluck(amp); @@ -58,20 +58,20 @@ void drone :: noteOn(MY_FLOAT freq, MY_FLOAT amp) #endif } -void drone :: noteOff(MY_FLOAT amp) +void drone :: noteOff(StkFloat amp) { - loopGain = (MY_FLOAT) 1.0 - amp; + loopGain = (StkFloat) 1.0 - amp; #if defined(_debug_) printf("drone : NoteOff: Amp=%lf\n",amp); #endif } -MY_FLOAT drone :: tick() +StkFloat drone :: tick() { /* check this out */ /* here's the whole inner loop of the instrument!! */ - lastOutput = delayLine->tick(loopFilt->tick((delayLine->lastOut() * loopGain)) + lastOutput_ = delayLine->tick(loopFilt->tick((delayLine->lastOut() * loopGain)) + (0.005 * envelope->tick() * noise->tick())); - return lastOutput; + return lastOutput_; } |