1 /***************************************************/
2 /*! \class Generator
3     \brief STK abstract unit generator parent class.
4 
5     This class provides common functionality for
6     STK unit generator sample-source subclasses.
7 
8     by Perry R. Cook and Gary P. Scavone, 1995 - 2005.
9 */
10 /***************************************************/
11 
12 #ifndef STK_GENERATOR_H
13 #define STK_GENERATOR_H
14 
15 #include "Stk.h"
16 
17 namespace Nyq
18 {
19 
20 class Generator : public Stk
21 {
22  public:
23   //! Class constructor.
24   Generator( void );
25 
26   //! Class destructor.
27   virtual ~Generator( void );
28 
29   //! Return the last output value.
lastOut(void)30   virtual StkFloat lastOut( void ) const { return lastOutput_; };
31 
32   //! Compute one sample and output.
33   StkFloat tick( void );
34 
35   //! Fill a channel of the StkFrames object with computed outputs.
36   /*!
37     The \c channel argument should be zero or greater (the first
38     channel is specified by 0).  An StkError will be thrown if the \c
39     channel argument is equal to or greater than the number of
40     channels in the StkFrames object.
41   */
42   StkFrames& tick( StkFrames& frames, unsigned int channel = 0 );
43 
44  protected:
45 
46   // This abstract function must be implemented in all subclasses.
47   // It is used to get around a C++ problem with overloaded virtual
48   // functions.
49   virtual StkFloat computeSample( void ) = 0;
50 
51   StkFloat lastOutput_;
52 
53 };
54 
55 } // namespace Nyq
56 
57 #endif
58 
59