CSL  6.0
SimpleSines.h
Go to the documentation of this file.
1 //
2 // SimpleSines.h -- specification of the simple waveform generators used as CSL tutorial examples
3 // See the copyright notice and acknowledgment of authors in the file COPYRIGHT
4 //
5 // What's here:
6 // SimpleSine -- the simplest sine oscillator class, this version has no dynamic controls
7 // SineAsPhased -- same as the above, except that it inherits its freq/phase members from Phased
8 // SineAsScaled -- this version has dynamic scale/offset controls, like most CSL UGens
9 
10 #ifndef CSL_SIMPLESINE_H
11 #define CSL_SIMPLESINE_H
12 
13 #include "CSL_Core.h" // include the main CSL header; this includes CSL_Types.h and CGestalt.h
14 
15 namespace csl { // All these classes live in their own C++ namespace
16 
17 ///
18 /// SimpleSine -- The simplest CSL sine oscillator class
19 ///
20 
21 class SimpleSine : public UnitGenerator {
22 
23 public:
24  SimpleSine(); ///< Constructors
25  SimpleSine(float frequency);
26  SimpleSine(float frequency, float phase);
27  ~SimpleSine(); ///< Destructor
28 
29  /// the monoNextBuffer method is where the DSP takes place
30  void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);
31 
32 protected:
33  float mFrequency; ///< my frequency value in Hz
34  float mPhase; ///< my instantaneous phase in Radians
35 };
36 
37 ///
38 /// SineAsPhased -- A sine oscillator that uses the Phased mix-in class,
39 /// meaning that we inherit mFrequency and mPhase and macros for dynamic control
40 ///
41 
42 class SineAsPhased : public UnitGenerator, public Phased {
43 
44 public:
45  SineAsPhased(); ///< Constructors
46  SineAsPhased(float frequency);
47  SineAsPhased(float frequency, float phase);
48  ~SineAsPhased(); ///< Destructor
49 
50  /// the monoNextBuffer method is where the DSP takes place
51  void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);
52  void dump(); ///< pretty-print the receiver
53 };
54 
55 ///
56 /// SineAsScaled -- A sine oscillator that also has scale and offset as dynamic controls (from Scalable)
57 /// (Note the tripple inheritance)
58 ///
59 
60 class SineAsScaled : public UnitGenerator, public Phased, public Scalable {
61 
62 public:
63  SineAsScaled(); ///< Constructors
64  SineAsScaled(float frequency);
65  SineAsScaled(float frequency, float phase);
66  SineAsScaled(float frequency, float phase, float ampl, float offset);
67  ~SineAsScaled(); ///< Destructor
68 
69  /// the monoNextBuffer method is where the DSP takes place
70  void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);
71  void dump(); ///< pretty-print the receiver
72 };
73 
74 }
75 
76 #endif
SimpleSine – The simplest CSL sine oscillator class.
Definition: SimpleSines.h:21
SineAsPhased – A sine oscillator that uses the Phased mix-in class, meaning that we inherit mFrequen...
Definition: SimpleSines.h:42
AdditiveInstrument.h – Sum-of-sines synthesis instrument class.
Definition: Accessor.h:17
~SimpleSine()
Destructor.
Definition: SimpleSines.cpp:23
Phased – a mix-in for objects with phase accumulators (local float) and frequency controls (an input...
Definition: CSL_Core.h:497
float mPhase
my instantaneous phase in Radians
Definition: SimpleSines.h:34
SineAsPhased()
Constructors.
Definition: SimpleSines.cpp:52
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
the monoNextBuffer method is where the DSP takes place
Definition: SimpleSines.cpp:29
void dump()
pretty-print the receiver
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
the monoNextBuffer method is where the DSP takes place
~SineAsScaled()
Destructor.
SineAsScaled – A sine oscillator that also has scale and offset as dynamic controls (from Scalable) ...
Definition: SimpleSines.h:60
Scalable – mix-in class with scale and offset control inputs (may be constants or generators)...
Definition: CSL_Core.h:403
float mFrequency
my frequency value in Hz
Definition: SimpleSines.h:33
SimpleSine()
Constructors.
Definition: SimpleSines.cpp:17
void dump()
pretty-print the receiver
SineAsScaled()
Constructors.
~SineAsPhased()
Destructor.
Definition: SimpleSines.cpp:58
Buffer – the multi-channel sample buffer class (passed around between generators and IO guys)...
Definition: CSL_Core.h:106
forward declaration
Definition: CSL_Core.h:241
Base class of CSL exceptions (written upper-case). Has a string message.
void nextBuffer(Buffer &outputBuffer, unsigned outBufNum)
the monoNextBuffer method is where the DSP takes place