Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Instrmnt.h
1 #ifndef STK_INSTRMNT_H
2 #define STK_INSTRMNT_H
3 
4 #include "Stk.h"
5 
6 namespace stk {
7 
8 /***************************************************/
17 /***************************************************/
18 
19 class Instrmnt : public Stk
20 {
21  public:
23  Instrmnt( void ) { lastFrame_.resize( 1, 1, 0.0 ); };
24 
26 
29  virtual void clear( void ) {};
30 
32  virtual void noteOn( StkFloat frequency, StkFloat amplitude ) = 0;
33 
35  virtual void noteOff( StkFloat amplitude ) = 0;
36 
38  virtual void setFrequency( StkFloat frequency );
39 
41  virtual void controlChange(int number, StkFloat value);
42 
44  unsigned int channelsOut( void ) const { return lastFrame_.channels(); };
45 
47  const StkFrames& lastFrame( void ) const { return lastFrame_; };
48 
50 
58  StkFloat lastOut( unsigned int channel = 0 );
59 
61 
64  virtual StkFloat tick( unsigned int channel = 0 ) = 0;
65 
67 
74  virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
75 
76  protected:
77 
78  StkFrames lastFrame_;
79 
80 };
81 
82 inline void Instrmnt :: setFrequency( StkFloat frequency )
83 {
84  oStream_ << "Instrmnt::setFrequency: virtual setFrequency function call!";
85  handleError( StkError::WARNING );
86 }
87 
88 inline StkFloat Instrmnt :: lastOut( unsigned int channel )
89 {
90 #if defined(_STK_DEBUG_)
91  if ( channel >= lastFrame_.channels() ) {
92  oStream_ << "Instrmnt::lastOut(): channel argument is invalid!";
93  handleError( StkError::FUNCTION_ARGUMENT );
94  }
95 #endif
96 
97  return lastFrame_[channel];
98 }
99 
100 inline void Instrmnt :: controlChange( int number, StkFloat value )
101 {
102  oStream_ << "Instrmnt::controlChange: virtual function call!";
103  handleError( StkError::WARNING );
104 }
105 
106 } // stk namespace
107 
108 #endif

The Synthesis ToolKit in C++ (STK)
©1995--2014 Perry R. Cook and Gary P. Scavone. All Rights Reserved.