mirror of
https://github.com/thestk/stk
synced 2026-04-22 23:44:36 +00:00
Version 4.4.3
This commit is contained in:
committed by
Stephen Sinclair
parent
baca57040b
commit
0aec39260a
@@ -8,7 +8,7 @@
|
||||
sample rates. You can specify the maximum polyphony (maximum
|
||||
number of simultaneous voices) in VoicDrum.h.
|
||||
|
||||
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
|
||||
by Perry R. Cook and Gary P. Scavone, 1995-2011.
|
||||
*/
|
||||
/***************************************************/
|
||||
|
||||
@@ -46,21 +46,9 @@ char voiceNames[VOICE_NUMWAVES][11] =
|
||||
|
||||
void VoicDrum :: noteOn( StkFloat instrument, StkFloat amplitude )
|
||||
{
|
||||
#if defined(_STK_DEBUG_)
|
||||
errorString_ << "VoicDrum::noteOn: instrument = " << instrument << ", amplitude = " << amplitude << '.';
|
||||
handleError( StkError::DEBUG_WARNING );
|
||||
#endif
|
||||
|
||||
StkFloat gain = amplitude;
|
||||
if ( amplitude > 1.0 ) {
|
||||
errorString_ << "VoicDrum::noteOn: amplitude parameter is greater than 1.0 ... setting to 1.0.";
|
||||
handleError( StkError::WARNING );
|
||||
gain = 1.0;
|
||||
}
|
||||
else if ( amplitude < 0.0 ) {
|
||||
errorString_ << "VoicDrum::noteOn: amplitude parameter is less than 0.0 ... doing nothing.";
|
||||
handleError( StkError::WARNING );
|
||||
return;
|
||||
if ( amplitude < 0.0 || amplitude > 1.0 ) {
|
||||
oStream_ << "VoicDrum::noteOn: amplitude parameter is out of bounds!";
|
||||
handleError( StkError::WARNING ); return;
|
||||
}
|
||||
|
||||
int noteNumber = ( (int) instrument ) % 11;
|
||||
@@ -76,8 +64,8 @@ void VoicDrum :: noteOn( StkFloat instrument, StkFloat amplitude )
|
||||
nSounding_++;
|
||||
}
|
||||
waves_[iWave].reset();
|
||||
filters_[iWave].setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[iWave].setGain( gain );
|
||||
filters_[iWave].setPole( 0.999 - (amplitude * 0.6) );
|
||||
filters_[iWave].setGain( amplitude );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -104,16 +92,18 @@ void VoicDrum :: noteOn( StkFloat instrument, StkFloat amplitude )
|
||||
waves_[iWave].openFile( (std::string("rawwaves/") + voiceNames[ noteNumber ]).c_str(), true );
|
||||
if ( Stk::sampleRate() != 22050.0 )
|
||||
waves_[iWave].setRate( 22050.0 / Stk::sampleRate() );
|
||||
filters_[iWave].setPole( 0.999 - (gain * 0.6) );
|
||||
filters_[iWave].setGain( gain );
|
||||
filters_[iWave].setPole( 0.999 - (amplitude * 0.6) );
|
||||
filters_[iWave].setGain( amplitude );
|
||||
}
|
||||
|
||||
/*
|
||||
#if defined(_STK_DEBUG_)
|
||||
errorString_ << "VoicDrum::noteOn: number sounding = " << nSounding_ << '\n';
|
||||
for (int i=0; i<nSounding_; i++) errorString_ << soundNumber_[i] << " ";
|
||||
errorString_ << '\n';
|
||||
handleError( StkError::DEBUG_WARNING );
|
||||
oStream << "VoicDrum::noteOn: number sounding = " << nSounding_ << '\n';
|
||||
for (int i=0; i<nSounding_; i++) oStream << soundNumber_[i] << " ";
|
||||
oStream << '\n';
|
||||
handleError( StkError::WARNING );
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
void VoicDrum :: noteOff( StkFloat amplitude )
|
||||
|
||||
Reference in New Issue
Block a user