mirror of
https://github.com/thestk/stk
synced 2026-01-18 15:11:53 +00:00
Version 4.4.0
This commit is contained in:
committed by
Stephen Sinclair
parent
d199342e86
commit
eccd8c9981
@@ -22,19 +22,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 "HevyMetl.h"
|
||||
|
||||
HevyMetl :: HevyMetl()
|
||||
namespace stk {
|
||||
|
||||
HevyMetl :: HevyMetl( 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 * 1.000);
|
||||
this->setRatio(1, 4.0 * 0.999);
|
||||
@@ -56,11 +58,11 @@ HevyMetl :: HevyMetl()
|
||||
modDepth_ = 0.0;
|
||||
}
|
||||
|
||||
HevyMetl :: ~HevyMetl()
|
||||
HevyMetl :: ~HevyMetl( void )
|
||||
{
|
||||
}
|
||||
|
||||
void HevyMetl :: noteOn(StkFloat frequency, StkFloat amplitude)
|
||||
void HevyMetl :: noteOn( StkFloat frequency, StkFloat amplitude )
|
||||
{
|
||||
gains_[0] = amplitude * fmGains_[92];
|
||||
gains_[1] = amplitude * fmGains_[76];
|
||||
@@ -75,29 +77,4 @@ void HevyMetl :: noteOn(StkFloat frequency, StkFloat amplitude)
|
||||
#endif
|
||||
}
|
||||
|
||||
StkFloat HevyMetl :: computeSample()
|
||||
{
|
||||
register StkFloat temp;
|
||||
|
||||
temp = vibrato_.tick() * modDepth_ * 0.2;
|
||||
waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[0]);
|
||||
waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[1]);
|
||||
waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[2]);
|
||||
waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp) * ratios_[3]);
|
||||
|
||||
temp = gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
waves_[1]->addPhaseOffset( temp );
|
||||
|
||||
waves_[3]->addPhaseOffset( twozero_.lastOut() );
|
||||
temp = (1.0 - (control2_ * 0.5)) * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
twozero_.tick(temp);
|
||||
|
||||
temp += control2_ * 0.5 * gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
temp = temp * control1_;
|
||||
|
||||
waves_[0]->addPhaseOffset( temp );
|
||||
temp = gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
|
||||
lastOutput_ = temp * 0.5;
|
||||
return lastOutput_;
|
||||
}
|
||||
} // stk namespace
|
||||
|
||||
Reference in New Issue
Block a user