Mercurial > hg > apm
diff stk/include/Generator.h @ 0:c0ead20bda4d
first commit
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Mon, 08 Jun 2015 11:49:43 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stk/include/Generator.h Mon Jun 08 11:49:43 2015 +0100 @@ -0,0 +1,50 @@ +#ifndef STK_GENERATOR_H +#define STK_GENERATOR_H + +#include "Stk.h" + +namespace stk { + +/***************************************************/ +/*! \class Generator + \brief STK abstract unit generator parent class. + + This class provides limited common functionality for STK unit + generator sample-source subclasses. It is general enough to + support both monophonic and polyphonic output classes. + + by Perry R. Cook and Gary P. Scavone, 1995--2014. +*/ +/***************************************************/ + +class Generator : public Stk +{ + public: + + //! Class constructor. + Generator( void ) { lastFrame_.resize( 1, 1, 0.0 ); }; + + //! Return the number of output channels for the class. + unsigned int channelsOut( void ) const { return lastFrame_.channels(); }; + + //! Return an StkFrames reference to the last output sample frame. + const StkFrames& lastFrame( void ) const { return lastFrame_; }; + + //! Fill the StkFrames object with computed sample frames, starting at the specified channel. + /*! + The \c channel argument plus the number of output channels must + be less than the number of channels in the StkFrames argument (the + first channel is specified by 0). However, range checking is only + performed if _STK_DEBUG_ is defined during compilation, in which + case an out-of-range value will trigger an StkError exception. + */ + virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0; + + protected: + + StkFrames lastFrame_; +}; + +} // stk namespace + +#endif