53 void noteOn( StkFloat frequency, StkFloat amplitude );
56 StkFloat
tick(
unsigned int channel = 0 );
72inline StkFloat TubeBell :: tick(
unsigned int )
76 temp = gains_[1] * adsr_[1]->tick() * waves_[1]->tick();
77 temp = temp * control1_;
79 waves_[0]->addPhaseOffset( temp );
80 waves_[3]->addPhaseOffset( twozero_.lastOut() );
81 temp = gains_[3] * adsr_[3]->tick() * waves_[3]->tick();
82 twozero_.tick( temp );
84 waves_[2]->addPhaseOffset( temp );
85 temp = ( 1.0 - (control2_ * 0.5)) * gains_[0] * adsr_[0]->tick() * waves_[0]->tick();
86 temp += control2_ * 0.5 * gains_[2] * adsr_[2]->tick() * waves_[2]->tick();
89 temp2 = vibrato_.tick() * modDepth_;
90 temp = temp * (1.0 + temp2);
92 lastFrame_[0] = temp * 0.5;
98 unsigned int nChannels = lastFrame_.
channels();
99#if defined(_STK_DEBUG_)
100 if ( channel > frames.
channels() - nChannels ) {
101 oStream_ <<
"TubeBell::tick(): channel and StkFrames arguments are incompatible!";
102 handleError( StkError::FUNCTION_ARGUMENT );
106 StkFloat *samples = &frames[channel];
107 unsigned int j, hop = frames.
channels() - nChannels;
108 if ( nChannels == 1 ) {
109 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop )
113 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
115 for ( j=1; j<nChannels; j++ )
116 *samples++ = lastFrame_[j];
STK abstract FM synthesis base class.
Definition FM.h:38
An STK class to handle vectorized audio data.
Definition Stk.h:279
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition Stk.h:416
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition Stk.h:419
STK tubular bell (orchestral chime) FM synthesis instrument.
Definition TubeBell.h:41
TubeBell(void)
Class constructor.
void noteOn(StkFloat frequency, StkFloat amplitude)
Start a note with the given frequency and amplitude.
~TubeBell(void)
Class destructor.
StkFloat tick(unsigned int channel=0)
Compute and return one output sample.
Definition TubeBell.h:72
The STK namespace.
Definition ADSR.h:6