CSL  5.2
WaveShaper.h
Go to the documentation of this file.
1 //
2 // WaveShaper.h -- CSL wave-shaping oscillator class that uses a look-up table
3 //
4 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
5 //
6 
7 #ifndef INCLUDE_WAVESHAPER_H
8 #define INCLUDE_WAVESHAPER_H
9 
10 #include "Oscillator.h" // my superclass
11 
12 namespace csl { // my namespace
13 
14 ///
15 /// WaveShaper -- Wave-shaping oscillator class
16 ///
17 
18 class WaveShaper : public Sine {
19 public:
20  WaveShaper();
21  WaveShaper(float frequency, unsigned sel = 0, unsigned size = CSL_mMaxBufferFrames);
22 
23  void setTableLength(unsigned length); ///< set the size in bytes of the table.
24  unsigned tableLength() { return mTableSize; };
25 
26  Buffer mTransferFunction; ///< the wave-shaping look-up table (it's just a sample buffer)
27 
28  void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);
29 
30 protected:
31  void initWaveTable(unsigned sel = 0); ///< function to initialize the default shaping table
32 
33 private:
34  unsigned mTableSize; ///< Table size in bytes.
35 
36 }; // end of class spec.
37 
38 } // end of namespace
39 
40 #endif