Version 4.4.0

This commit is contained in:
Gary Scavone
2013-09-29 23:11:39 +02:00
committed by Stephen Sinclair
parent d199342e86
commit eccd8c9981
287 changed files with 11712 additions and 7676 deletions

View File

@@ -26,19 +26,21 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
*/
/***************************************************/
#include "Rhodey.h"
Rhodey :: Rhodey()
namespace stk {
Rhodey :: Rhodey( void )
: FM()
{
// Concatenate the STK rawwave path to the rawwave files
for ( unsigned int i=0; i<3; i++ )
waves_[i] = new WaveLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), true );
waves_[3] = new WaveLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), true );
waves_[i] = new FileLoop( (Stk::rawwavePath() + "sinewave.raw").c_str(), true );
waves_[3] = new FileLoop( (Stk::rawwavePath() + "fwavblnk.raw").c_str(), true );
this->setRatio(0, 1.0);
this->setRatio(1, 0.5);
@@ -58,11 +60,11 @@ Rhodey :: Rhodey()
twozero_.setGain( 1.0 );
}
Rhodey :: ~Rhodey()
Rhodey :: ~Rhodey( void )
{
}
void Rhodey :: setFrequency(StkFloat frequency)
void Rhodey :: setFrequency( StkFloat frequency )
{
baseFrequency_ = frequency * 2.0;
@@ -70,7 +72,7 @@ void Rhodey :: setFrequency(StkFloat frequency)
waves_[i]->setFrequency( baseFrequency_ * ratios_[i] );
}
void Rhodey :: noteOn(StkFloat frequency, StkFloat amplitude)
void Rhodey :: noteOn( StkFloat frequency, StkFloat amplitude )
{
gains_[0] = amplitude * fmGains_[99];
gains_[1] = amplitude * fmGains_[90];
@@ -85,26 +87,4 @@ void Rhodey :: noteOn(StkFloat frequency, StkFloat amplitude)
#endif
}
StkFloat Rhodey :: computeSample()
{
StkFloat temp, temp2;
temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
temp = temp * control1_;
waves_[0]->addPhaseOffset( temp );
waves_[3]->addPhaseOffset( twozero_.lastOut() );
temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
twozero_.tick(temp);
waves_[2]->addPhaseOffset( temp );
temp = ( 1.0 - (control2_ * 0.5)) * gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
temp += control2_ * 0.5 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
// Calculate amplitude modulation and apply it to output.
temp2 = vibrato_.tick() * modDepth_;
temp = temp * (1.0 + temp2);
lastOutput_ = temp * 0.5;
return lastOutput_;
}
} // stk namespace