56 void noteOn( StkFloat frequency, StkFloat amplitude );
62 StkFloat
tick(
unsigned int channel = 0 );
85 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
86 temp2 = vibrato_.
tick() * modDepth_ * 0.1;
88 waves_[0]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[0]);
89 waves_[1]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[1]);
90 waves_[2]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[2]);
91 waves_[3]->setFrequency(baseFrequency_ * (1.0 + temp2) * ratios_[3]);
93 waves_[0]->addPhaseOffset(temp * mods_[0]);
94 waves_[1]->addPhaseOffset(temp * mods_[1]);
95 waves_[2]->addPhaseOffset(temp * mods_[2]);
96 waves_[3]->addPhaseOffset( twozero_.
lastOut() );
97 twozero_.
tick( temp );
98 temp = gains_[0] * tilt_[0] * adsr_[0]->tick() * waves_[0]->tick();
99 temp += gains_[1] * tilt_[1] * adsr_[1]->tick() * waves_[1]->tick();
100 temp += gains_[2] * tilt_[2] * adsr_[2]->tick() * waves_[2]->tick();
102 lastFrame_[0] = temp * 0.33;
103 return lastFrame_[0];
108 unsigned int nChannels = lastFrame_.
channels();
109 #if defined(_STK_DEBUG_)
110 if ( channel > frames.
channels() - nChannels ) {
111 oStream_ <<
"FMVoices::tick(): channel and StkFrames arguments are incompatible!";
116 StkFloat *samples = &frames[channel];
117 unsigned int j, hop = frames.
channels() - nChannels;
118 if ( nChannels == 1 ) {
119 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
123 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
125 for ( j=1; j<nChannels; j++ )
126 *samples++ = lastFrame_[j];