Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial
STK jet table class. More...
#include <JetTable.h>
Public Member Functions | |
StkFloat | tick (StkFloat input) |
Take one sample input and map to one sample of output. | |
StkFrames & | tick (StkFrames &frames, unsigned int channel=0) |
Take a channel of the StkFrames object as inputs to the table and replace with corresponding outputs. | |
StkFrames & | tick (StkFrames &iFrames, StkFrames &oFrames, unsigned int iChannel=0, unsigned int oChannel=0) |
Take a channel of the iFrames object as inputs to the table and write outputs to the oFrames object. |
STK jet table class.
This class implements a flue jet non-linear function, computed by a polynomial calculation. Contrary to the name, this is not a "table".
Consult Fletcher and Rossing, Karjalainen, Cook, and others for more information.
by Perry R. Cook and Gary P. Scavone, 1995-2011.
Take a channel of the StkFrames object as inputs to the table and replace with corresponding outputs.
The StkFrames argument reference is returned. The channel
argument must be less than the number of channels in the StkFrames argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
00068 { 00069 #if defined(_STK_DEBUG_) 00070 if ( channel >= frames.channels() ) { 00071 oStream_ << "JetTable::tick(): channel and StkFrames arguments are incompatible!"; 00072 handleError( StkError::FUNCTION_ARGUMENT ); 00073 } 00074 #endif 00075 00076 StkFloat *samples = &frames[channel]; 00077 unsigned int hop = frames.channels(); 00078 for ( unsigned int i=0; i<frames.frames(); i++, samples += hop ) { 00079 *samples = *samples * (*samples * *samples - 1.0); 00080 if ( *samples > 1.0) *samples = 1.0; 00081 if ( *samples < -1.0) *samples = -1.0; 00082 } 00083 00084 lastFrame_[0] = *(samples-hop); 00085 return frames; 00086 }
StkFrames & stk::JetTable::tick | ( | StkFrames & | iFrames, | |
StkFrames & | oFrames, | |||
unsigned int | iChannel = 0 , |
|||
unsigned int | oChannel = 0 | |||
) | [inline] |
Take a channel of the iFrames
object as inputs to the table and write outputs to the oFrames
object.
The iFrames
object reference is returned. Each channel argument must be less than the number of channels in the corresponding StkFrames argument (the first channel is specified by 0). However, range checking is only performed if _STK_DEBUG_ is defined during compilation, in which case an out-of-range value will trigger an StkError exception.
00089 { 00090 #if defined(_STK_DEBUG_) 00091 if ( iChannel >= iFrames.channels() || oChannel >= oFrames.channels() ) { 00092 oStream_ << "JetTable::tick(): channel and StkFrames arguments are incompatible!"; 00093 handleError( StkError::FUNCTION_ARGUMENT ); 00094 } 00095 #endif 00096 00097 StkFloat *iSamples = &iFrames[iChannel]; 00098 StkFloat *oSamples = &oFrames[oChannel]; 00099 unsigned int iHop = iFrames.channels(), oHop = oFrames.channels(); 00100 for ( unsigned int i=0; i<iFrames.frames(); i++, iSamples += iHop, oSamples += oHop ) { 00101 *oSamples = *oSamples * (*oSamples * *oSamples - 1.0); 00102 if ( *oSamples > 1.0) *oSamples = 1.0; 00103 if ( *oSamples < -1.0) *oSamples = -1.0; 00104 } 00105 00106 lastFrame_[0] = *(oSamples-oHop); 00107 return iFrames; 00108 }
The Synthesis ToolKit in C++ (STK) |
©1995-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved. |