/***************************************************/ /*! \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) via a #define in the Drummer.h. by Perry R. Cook and Gary P. Scavone, 1995 - 2002. */ /***************************************************/ #include "Tabla.h" #include #include Tabla :: Tabla() : Instrmnt() { for (int i=0; i= 0 ) { // Reset this sound. waves[waveIndex]->reset(); filters[waveIndex]->setPole((MY_FLOAT) 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(); WvIn *tempWv = waves[0]; OnePole *tempFilt = filters[0]; // Re-order the list. for (i=0; inormalize(0.4); filters[nSounding-1]->setPole((MY_FLOAT) 0.999 - (gain * 0.6) ); filters[nSounding-1]->setGain( gain ); } #if defined(_STK_DEBUG_) cerr << "Number Sounding = " << nSounding << endl; for (i=0; isetGain( amplitude * 0.01 ); } } MY_FLOAT Tabla :: tick() { MY_FLOAT output = 0.0; OnePole *tempFilt; int j, i = 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 output += filters[i]->tick( waves[i]->tick() ); i++; } return output; }