26 BowTable(
void ) : offset_(0.0), slope_(0.1), minOutput_(0.01), maxOutput_(0.98) {};
35 void setOffset( StkFloat offset ) { offset_ = offset; };
42 void setSlope( StkFloat slope ) { slope_ = slope; };
51 StkFloat
tick( StkFloat input );
87 StkFloat sample = input + offset_;
89 lastFrame_[0] = (StkFloat) fabs( (
double) sample ) + (StkFloat) 0.75;
90 lastFrame_[0] = (StkFloat) pow( lastFrame_[0], (StkFloat) -4.0 );
93 if ( lastFrame_[0] < minOutput_ ) lastFrame_[0] = minOutput_;
96 if ( lastFrame_[0] > maxOutput_ ) lastFrame_[0] = maxOutput_;
103 #if defined(_STK_DEBUG_)
104 if ( channel >= frames.
channels() ) {
105 oStream_ <<
"BowTable::tick(): channel and StkFrames arguments are incompatible!";
110 StkFloat *samples = &frames[channel];
111 unsigned int hop = frames.
channels();
112 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
113 *samples = *samples + offset_;
115 *samples = (StkFloat) fabs( (
double) *samples ) + 0.75;
116 *samples = (StkFloat) pow( *samples, (StkFloat) -4.0 );
117 if ( *samples > 1.0) *samples = 1.0;
120 lastFrame_[0] = *(samples-hop);
126 #if defined(_STK_DEBUG_)
128 oStream_ <<
"BowTable::tick(): channel and StkFrames arguments are incompatible!";
133 StkFloat *iSamples = &iFrames[iChannel];
134 StkFloat *oSamples = &oFrames[oChannel];
136 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
137 *oSamples = *iSamples + offset_;
139 *oSamples = (StkFloat) fabs( (
double) *oSamples ) + 0.75;
140 *oSamples = (StkFloat) pow( *oSamples, (StkFloat) -4.0 );
141 if ( *oSamples > 1.0) *oSamples = 1.0;
144 lastFrame_[0] = *(oSamples-oHop);