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 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
4 //
5 #ifndef INCLUDE_WAVESHAPER_H
6 #define INCLUDE_WAVESHAPER_H
7 
8 #include "Oscillator.h" // my superclass
9 
10 namespace csl { // my namespace
11 
12 ///
13 /// WaveShaper -- Wave-shaping oscillator class
14 ///
15 
16 class WaveShaper : public Sine {
17 public:
18  WaveShaper();
19  WaveShaper(float frequency, unsigned size = 8192);
20 
21  void setTableLenght(unsigned length); ///< set the size in bytes of the table.
22  unsigned tableLength() { return mTableSize; };
23 
24  Buffer mTransferFunction; // the wave-shaping look-up table (it's just a sample buffer)
25 
26 protected:
27  status mono_next_buffer(Buffer & inputBuffer, Buffer & outputBuffer, unsigned inBufNum, unsigned outBufNum);
28  void initWaveTable(); // function to initialize the default shaping table
29 
30 private:
31  unsigned mTableSize; ///< Table size in bytes.
32 
33 }; // end of class spec.
34 
35 } // end of namespace
36 
37 #endif