mirror of
https://github.com/thestk/stk
synced 2026-01-13 13:01:52 +00:00
Version 4.2.0
This commit is contained in:
committed by
Stephen Sinclair
parent
cf06b7598b
commit
a6381b9d38
@@ -28,7 +28,7 @@
|
||||
type who should worry about this (making
|
||||
money) worry away.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2002.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2004.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -38,66 +38,77 @@ BeeThree :: BeeThree()
|
||||
: FM()
|
||||
{
|
||||
// Concatenate the STK rawwave path to the rawwave files
|
||||
for ( 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 );
|
||||
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 );
|
||||
|
||||
this->setRatio(0, 0.999);
|
||||
this->setRatio(1, 1.997);
|
||||
this->setRatio(2, 3.006);
|
||||
this->setRatio(3, 6.009);
|
||||
|
||||
gains[0] = __FM_gains[95];
|
||||
gains[1] = __FM_gains[95];
|
||||
gains[2] = __FM_gains[99];
|
||||
gains[3] = __FM_gains[95];
|
||||
gains_[0] = fmGains_[95];
|
||||
gains_[1] = fmGains_[95];
|
||||
gains_[2] = fmGains_[99];
|
||||
gains_[3] = fmGains_[95];
|
||||
|
||||
adsr[0]->setAllTimes( 0.005, 0.003, 1.0, 0.01);
|
||||
adsr[1]->setAllTimes( 0.005, 0.003, 1.0, 0.01);
|
||||
adsr[2]->setAllTimes( 0.005, 0.003, 1.0, 0.01);
|
||||
adsr[3]->setAllTimes( 0.005, 0.001, 0.4, 0.03);
|
||||
adsr_[0]->setAllTimes( 0.005, 0.003, 1.0, 0.01);
|
||||
adsr_[1]->setAllTimes( 0.005, 0.003, 1.0, 0.01);
|
||||
adsr_[2]->setAllTimes( 0.005, 0.003, 1.0, 0.01);
|
||||
adsr_[3]->setAllTimes( 0.005, 0.001, 0.4, 0.03);
|
||||
|
||||
twozero->setGain( 0.1 );
|
||||
twozero_.setGain( 0.1 );
|
||||
}
|
||||
|
||||
BeeThree :: ~BeeThree()
|
||||
{
|
||||
}
|
||||
|
||||
void BeeThree :: noteOn(MY_FLOAT frequency, MY_FLOAT amplitude)
|
||||
void BeeThree :: noteOn(StkFloat frequency, StkFloat amplitude)
|
||||
{
|
||||
gains[0] = amplitude * __FM_gains[95];
|
||||
gains[1] = amplitude * __FM_gains[95];
|
||||
gains[2] = amplitude * __FM_gains[99];
|
||||
gains[3] = amplitude * __FM_gains[95];
|
||||
this->setFrequency(frequency);
|
||||
gains_[0] = amplitude * fmGains_[95];
|
||||
gains_[1] = amplitude * fmGains_[95];
|
||||
gains_[2] = amplitude * fmGains_[99];
|
||||
gains_[3] = amplitude * fmGains_[95];
|
||||
this->setFrequency( frequency );
|
||||
this->keyOn();
|
||||
|
||||
#if defined(_STK_DEBUG_)
|
||||
cerr << "BeeThree: NoteOn frequency = " << frequency << ", amplitude = " << amplitude << endl;
|
||||
errorString_ << "BeeThree::NoteOn: frequency = " << frequency << ", amplitude = " << amplitude << '.';
|
||||
handleError( StkError::DEBUG_WARNING );
|
||||
#endif
|
||||
}
|
||||
|
||||
MY_FLOAT BeeThree :: tick()
|
||||
StkFloat BeeThree :: tick()
|
||||
{
|
||||
register MY_FLOAT temp;
|
||||
register StkFloat temp;
|
||||
|
||||
if (modDepth > 0.0) {
|
||||
temp = 1.0 + (modDepth * vibrato->tick() * 0.1);
|
||||
waves[0]->setFrequency(baseFrequency * temp * ratios[0]);
|
||||
waves[1]->setFrequency(baseFrequency * temp * ratios[1]);
|
||||
waves[2]->setFrequency(baseFrequency * temp * ratios[2]);
|
||||
waves[3]->setFrequency(baseFrequency * temp * ratios[3]);
|
||||
if (modDepth_ > 0.0) {
|
||||
temp = 1.0 + (modDepth_ * vibrato_->tick() * 0.1);
|
||||
waves_[0]->setFrequency(baseFrequency_ * temp * ratios_[0]);
|
||||
waves_[1]->setFrequency(baseFrequency_ * temp * ratios_[1]);
|
||||
waves_[2]->setFrequency(baseFrequency_ * temp * ratios_[2]);
|
||||
waves_[3]->setFrequency(baseFrequency_ * temp * ratios_[3]);
|
||||
}
|
||||
|
||||
waves[3]->addPhaseOffset(twozero->lastOut());
|
||||
temp = control1 * 2.0 * gains[3] * adsr[3]->tick() * waves[3]->tick();
|
||||
twozero->tick(temp);
|
||||
waves_[3]->addPhaseOffset( twozero_.lastOut() );
|
||||
temp = control1_ * 2.0 * gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
|
||||
twozero_.tick(temp);
|
||||
|
||||
temp += control2 * 2.0 * gains[2] * adsr[2]->tick() * waves[2]->tick();
|
||||
temp += gains[1] * adsr[1]->tick() * waves[1]->tick();
|
||||
temp += gains[0] * adsr[0]->tick() * waves[0]->tick();
|
||||
temp += control2_ * 2.0 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
|
||||
temp += gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
|
||||
temp += gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
|
||||
|
||||
lastOutput = temp * 0.125;
|
||||
return lastOutput;
|
||||
lastOutput_ = temp * 0.125;
|
||||
return lastOutput_;
|
||||
}
|
||||
|
||||
StkFloat *BeeThree :: tick(StkFloat *vector, unsigned int vectorSize)
|
||||
{
|
||||
return Instrmnt::tick( vector, vectorSize );
|
||||
}
|
||||
|
||||
StkFrames& BeeThree :: tick( StkFrames& frames, unsigned int channel )
|
||||
{
|
||||
return Instrmnt::tick( frames, channel );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user