1 #ifndef STK_REEDTABLE_H
2 #define STK_REEDTABLE_H
39 void setOffset( StkFloat offset ) { offset_ = offset; };
47 void setSlope( StkFloat slope ) { slope_ = slope; };
50 StkFloat
tick( StkFloat input );
84 lastFrame_[0] = offset_ + (slope_ * input);
88 if ( lastFrame_[0] > 1.0) lastFrame_[0] = (StkFloat) 1.0;
93 if ( lastFrame_[0] < -1.0) lastFrame_[0] = (StkFloat) -1.0;
100 #if defined(_STK_DEBUG_)
101 if ( channel >= frames.
channels() ) {
102 oStream_ <<
"ReedTable::tick(): channel and StkFrames arguments are incompatible!";
107 StkFloat *samples = &frames[channel];
108 unsigned int hop = frames.
channels();
109 for (
unsigned int i=0; i<frames.
frames(); i++, samples += hop ) {
110 *samples = offset_ + (slope_ * *samples);
111 if ( *samples > 1.0) *samples = 1.0;
112 if ( *samples < -1.0) *samples = -1.0;
115 lastFrame_[0] = *(samples-hop);
121 #if defined(_STK_DEBUG_)
123 oStream_ <<
"ReedTable::tick(): channel and StkFrames arguments are incompatible!";
128 StkFloat *iSamples = &iFrames[iChannel];
129 StkFloat *oSamples = &oFrames[oChannel];
131 for (
unsigned int i=0; i<iFrames.
frames(); i++, iSamples += iHop, oSamples += oHop ) {
132 *oSamples = offset_ + (slope_ * *iSamples);
133 if ( *oSamples > 1.0) *oSamples = 1.0;
134 if ( *oSamples < -1.0) *oSamples = -1.0;
137 lastFrame_[0] = *(oSamples-oHop);
STK abstract function parent class.
Definition: Function.h:21
STK reed table class.
Definition: ReedTable.h:28
ReedTable(void)
Default constructor.
Definition: ReedTable.h:31
StkFloat tick(StkFloat input)
Take one sample input and map to one sample of output.
Definition: ReedTable.h:81
void setSlope(StkFloat slope)
Set the table slope value.
Definition: ReedTable.h:47
void setOffset(StkFloat offset)
Set the table offset value.
Definition: ReedTable.h:39
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