f@0: #ifndef STK_GENERATOR_H f@0: #define STK_GENERATOR_H f@0: f@0: #include "Stk.h" f@0: f@0: namespace stk { f@0: f@0: /***************************************************/ f@0: /*! \class Generator f@0: \brief STK abstract unit generator parent class. f@0: f@0: This class provides limited common functionality for STK unit f@0: generator sample-source subclasses. It is general enough to f@0: support both monophonic and polyphonic output classes. f@0: f@0: by Perry R. Cook and Gary P. Scavone, 1995--2014. f@0: */ f@0: /***************************************************/ f@0: f@0: class Generator : public Stk f@0: { f@0: public: f@0: f@0: //! Class constructor. f@0: Generator( void ) { lastFrame_.resize( 1, 1, 0.0 ); }; f@0: f@0: //! Return the number of output channels for the class. f@0: unsigned int channelsOut( void ) const { return lastFrame_.channels(); }; f@0: f@0: //! Return an StkFrames reference to the last output sample frame. f@0: const StkFrames& lastFrame( void ) const { return lastFrame_; }; f@0: f@0: //! Fill the StkFrames object with computed sample frames, starting at the specified channel. f@0: /*! f@0: The \c channel argument plus the number of output channels must f@0: be less than the number of channels in the StkFrames argument (the f@0: first channel is specified by 0). However, range checking is only f@0: performed if _STK_DEBUG_ is defined during compilation, in which f@0: case an out-of-range value will trigger an StkError exception. f@0: */ f@0: virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0; f@0: f@0: protected: f@0: f@0: StkFrames lastFrame_; f@0: }; f@0: f@0: } // stk namespace f@0: f@0: #endif