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);
STK bowed string table class.
Definition: BowTable.h:23
BowTable(void)
Default constructor.
Definition: BowTable.h:26
void setMaxOutput(StkFloat maximum)
Set the maximum table output value (0.0 - 1.0).
Definition: BowTable.h:48
StkFloat tick(StkFloat input)
Take one sample input and map to one sample of output.
Definition: BowTable.h:84
void setMinOutput(StkFloat minimum)
Set the minimum table output value (0.0 - 1.0).
Definition: BowTable.h:45
void setOffset(StkFloat offset)
Set the table offset value.
Definition: BowTable.h:35
void setSlope(StkFloat slope)
Set the table slope value.
Definition: BowTable.h:42
STK abstract function parent class.
Definition: Function.h:21
An STK class to handle vectorized audio data.
Definition: Stk.h:287
unsigned int channels(void) const
Return the number of channels represented by the data.
Definition: Stk.h:415
unsigned int frames(void) const
Return the number of sample frames represented by the data.
Definition: Stk.h:418
static void handleError(const char *message, StkError::Type type)
Static function for error reporting and handling using c-strings.
The STK namespace.
Definition: ADSR.h:8