/***************************************************/ /*! \class Tabla \brief STK tabla drum class. This class implements a drum sampling synthesizer using WvIn objects and one-pole filters. The drum rawwave files are sampled at 22050 Hz, but will be appropriately interpolated for other sample rates. You can specify the maximum polyphony (maximum number of simultaneous voices) in Drummer.h. by Perry R. Cook and Gary P. Scavone, 1995 - 2004. */ /***************************************************/ #include "Tabla.h" #include Tabla :: Tabla() : Instrmnt() { for ( int i=0; i= 0 ) { // Reset this sound. waves_[waveIndex]->reset(); filters_[waveIndex]->setPole( 0.999 - (gain * 0.6) ); filters_[waveIndex]->setGain( gain ); } else { if ( nSounding_ == TABLA_POLYPHONY ) { // If we're already at maximum polyphony, then preempt the oldest voice. delete waves_[0]; filters_[0]->clear(); OnePole *tempFilt = filters_[0]; // Re-order the list. for ( i=0; inormalize(0.4); if ( Stk::sampleRate() != 22050.0 ) waves_[nSounding_-1]->setRate( 22050.0 / Stk::sampleRate() ); filters_[nSounding_-1]->setPole( 0.999 - (gain * 0.6) ); filters_[nSounding_-1]->setGain( gain ); } #if defined(_STK_DEBUG_) errorString_ << "Tabla::noteOn: number sounding = " << nSounding_ << '\n'; for (i=0; isetGain( amplitude * 0.01 ); } StkFloat Tabla :: tick() { OnePole *tempFilt; int j, i = 0; lastOutput_ = 0.0; while ( i < nSounding_ ) { if ( waves_[i]->isFinished() ) { delete waves_[i]; tempFilt = filters_[i]; // Re-order the list. for ( j=i; jclear(); sounding_[j] = -1; nSounding_ -= 1; i -= 1; } else lastOutput_ += filters_[i]->tick( waves_[i]->tick() ); i++; } return lastOutput_; } StkFloat *Tabla :: tick(StkFloat *vector, unsigned int vectorSize) { return Instrmnt::tick( vector, vectorSize ); } StkFrames& Tabla :: tick( StkFrames& frames, unsigned int channel ) { return Instrmnt::tick( frames, channel ); }