From e625413ae9b5cb00209ab406283fff0b622eb5a7 Mon Sep 17 00:00:00 2001 From: "N.N." Date: Sun, 14 Nov 2004 22:47:29 +0000 Subject: adapted for STK 4.2.0 svn path=/trunk/externals/unauthorized/; revision=2271 --- stkdrone~/drone.cc | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'stkdrone~/drone.cc') 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_; } -- cgit v1.2.1