Version 4.4.3

This commit is contained in:
Gary Scavone
2013-09-29 23:21:29 +02:00
committed by Stephen Sinclair
parent baca57040b
commit 0aec39260a
223 changed files with 26190 additions and 11130 deletions

View File

@@ -26,7 +26,7 @@
type who should worry about this (making
money) worry away.
by Perry R. Cook and Gary P. Scavone, 1995 - 2010.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
*/
/***************************************************/
@@ -75,6 +75,13 @@ FMVoices :: ~FMVoices( void )
void FMVoices :: setFrequency( StkFloat frequency )
{
#if defined(_STK_DEBUG_)
if ( frequency <= 0.0 ) {
oStream_ << "FMVoices::setFrequency: argument is less than or equal to zero!";
handleError( StkError::WARNING ); return;
}
#endif
StkFloat temp, temp2 = 0.0;
int tempi = 0;
unsigned int i = 0;
@@ -118,51 +125,38 @@ void FMVoices :: noteOn( StkFloat frequency, StkFloat amplitude )
tilt_[1] = amplitude * amplitude;
tilt_[2] = tilt_[1] * amplitude;
this->keyOn();
#if defined(_STK_DEBUG_)
errorString_ << "FMVoices::NoteOn: frequency = " << frequency << ", amplitude = " << amplitude << '.';
handleError( StkError::DEBUG_WARNING );
#endif
}
void FMVoices :: controlChange( int number, StkFloat value )
{
StkFloat norm = value * ONE_OVER_128;
if ( norm < 0 ) {
norm = 0.0;
errorString_ << "FMVoices::controlChange: control value less than zero ... setting to zero!";
handleError( StkError::WARNING );
}
else if ( norm > 1.0 ) {
norm = 1.0;
errorString_ << "FMVoices::controlChange: control value greater than 128.0 ... setting to 128.0!";
handleError( StkError::WARNING );
#if defined(_STK_DEBUG_)
if ( Stk::inRange( value, 0.0, 128.0 ) == false ) {
oStream_ << "FMVoices::controlChange: value (" << value << ") is out of range!";
handleError( StkError::WARNING ); return;
}
#endif
StkFloat normalizedValue = value * ONE_OVER_128;
if (number == __SK_Breath_) // 2
gains_[3] = fmGains_[(int) ( norm * 99.9 )];
gains_[3] = fmGains_[(int) ( normalizedValue * 99.9 )];
else if (number == __SK_FootControl_) { // 4
currentVowel_ = (int) (norm * 128.0);
currentVowel_ = (int) (normalizedValue * 128.0);
this->setFrequency(baseFrequency_);
}
else if (number == __SK_ModFrequency_) // 11
this->setModulationSpeed( norm * 12.0);
this->setModulationSpeed( normalizedValue * 12.0);
else if (number == __SK_ModWheel_) // 1
this->setModulationDepth( norm );
this->setModulationDepth( normalizedValue );
else if (number == __SK_AfterTouch_Cont_) { // 128
tilt_[0] = norm;
tilt_[1] = norm * norm;
tilt_[2] = tilt_[1] * norm;
tilt_[0] = normalizedValue;
tilt_[1] = normalizedValue * normalizedValue;
tilt_[2] = tilt_[1] * normalizedValue;
}
#if defined(_STK_DEBUG_)
else {
errorString_ << "FMVoices::controlChange: undefined control number (" << number << ")!";
oStream_ << "FMVoices::controlChange: undefined control number (" << number << ")!";
handleError( StkError::WARNING );
}
#if defined(_STK_DEBUG_)
errorString_ << "FMVoices::controlChange: number = " << number << ", value = " << value << '.';
handleError( StkError::DEBUG_WARNING );
#endif
}