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