CSL  6.0
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
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Definition: Accessor.h:17
void setTableLength(unsigned length)
set the size in bytes of the table.
WaveShaper – Wave-shaping oscillator class.
Definition: WaveShaper.h:18
Buffer mTransferFunction
the wave-shaping look-up table (it's just a sample buffer)
Definition: WaveShaper.h:24
#define CSL_mMaxBufferFrames
max block size (set large for zooming scopes)
Definition: CSL_Types.h:100
unsigned tableLength()
Definition: WaveShaper.h:24
void initWaveTable(unsigned sel=0)
function to initialize the default shaping table
Definition: WaveShaper.cpp:25
static size_t size
Definition: fft_N.c:40
Sine – oscillator class (this computes the sine fcn on the fly)
Definition: Oscillator.h:108
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Definition: CSL_Core.h:106
unsigned mTableSize
Table size in bytes.
Definition: WaveShaper.h:34
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
really compute the next buffer given an offset base channel; this is called by nextBuffer, possibly multiple times
Definition: WaveShaper.cpp:69
Base class of CSL exceptions (written upper-case). Has a string message.