Version 4.4.0

This commit is contained in:
Gary Scavone
2013-09-29 23:11:39 +02:00
committed by Stephen Sinclair
parent d199342e86
commit eccd8c9981
287 changed files with 11712 additions and 7676 deletions

View File

@@ -8,14 +8,16 @@
sample rates. You can specify the maximum polyphony (maximum
number of simultaneous voices) in Tabla.h.
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
by Perry R. Cook and Gary P. Scavone, 1995 - 2009.
*/
/***************************************************/
#include "Tabla.h"
#include <cmath>
Tabla :: Tabla() : Instrmnt()
namespace stk {
Tabla :: Tabla( void ) : Instrmnt()
{
// This counts the number of sounding voices.
nSounding_ = 0;
@@ -23,7 +25,7 @@ Tabla :: Tabla() : Instrmnt()
soundNumber_ = std::vector<int> (TABLA_POLYPHONY, -1);
}
Tabla :: ~Tabla()
Tabla :: ~Tabla( void )
{
}
@@ -45,7 +47,7 @@ static char tablaWaves[TABLA_NUMWAVES][16] =
"DrTak2.raw"
};
void Tabla :: noteOn(StkFloat instrument, StkFloat amplitude)
void Tabla :: noteOn( StkFloat instrument, StkFloat amplitude )
{
#if defined(_STK_DEBUG_)
errorString_ << "Tabla::noteOn: instrument = " << instrument << ", amplitude = " << amplitude << '.';
@@ -117,34 +119,11 @@ void Tabla :: noteOn(StkFloat instrument, StkFloat amplitude)
#endif
}
void Tabla :: noteOff(StkFloat amplitude)
void Tabla :: noteOff( StkFloat amplitude )
{
// Set all sounding wave filter gains low.
int i = 0;
while ( i < nSounding_ ) filters_[i++].setGain( amplitude * 0.01 );
}
StkFloat Tabla :: computeSample()
{
lastOutput_ = 0.0;
if ( nSounding_ == 0 ) return lastOutput_;
for ( int i=0; i<TABLA_POLYPHONY; i++ ) {
if ( soundOrder_[i] >= 0 ) {
if ( waves_[i].isFinished() ) {
// Re-order the list.
for ( int j=0; j<TABLA_POLYPHONY; j++ ) {
if ( soundOrder_[j] > soundOrder_[i] )
soundOrder_[j] -= 1;
}
soundOrder_[i] = -1;
nSounding_--;
}
else
lastOutput_ += filters_[i].tick( waves_[i].tick() );
}
}
return lastOutput_;
}
} // stk namespace