You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.5KB

  1. #ifndef STK_GENERATOR_H
  2. #define STK_GENERATOR_H
  3. #include "Stk.h"
  4. namespace stk {
  5. /***************************************************/
  6. /*! \class Generator
  7. \brief STK abstract unit generator parent class.
  8. This class provides limited common functionality for STK unit
  9. generator sample-source subclasses. It is general enough to
  10. support both monophonic and polyphonic output classes.
  11. by Perry R. Cook and Gary P. Scavone, 1995--2017.
  12. */
  13. /***************************************************/
  14. class Generator : public Stk
  15. {
  16. public:
  17. //! Class constructor.
  18. Generator( void ) { lastFrame_.resize( 1, 1, 0.0 ); };
  19. //! Return the number of output channels for the class.
  20. unsigned int channelsOut( void ) const { return lastFrame_.channels(); };
  21. //! Return an StkFrames reference to the last output sample frame.
  22. const StkFrames& lastFrame( void ) const { return lastFrame_; };
  23. //! Fill the StkFrames object with computed sample frames, starting at the specified channel.
  24. /*!
  25. The \c channel argument plus the number of output channels must
  26. be less than the number of channels in the StkFrames argument (the
  27. first channel is specified by 0). However, range checking is only
  28. performed if _STK_DEBUG_ is defined during compilation, in which
  29. case an out-of-range value will trigger an StkError exception.
  30. */
  31. virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
  32. protected:
  33. StkFrames lastFrame_;
  34. };
  35. } // stk namespace
  36. #endif