Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Instrmnt.h

00001 #ifndef STK_INSTRMNT_H
00002 #define STK_INSTRMNT_H
00003 
00004 #include "Stk.h"
00005 
00006 namespace stk {
00007 
00008 /***************************************************/
00017 /***************************************************/
00018 
00019 class Instrmnt : public Stk
00020 {
00021  public:
00023   Instrmnt( void ) { lastFrame_.resize( 1, 1, 0.0 ); };
00024 
00026   virtual void noteOn( StkFloat frequency, StkFloat amplitude ) = 0;
00027 
00029   virtual void noteOff( StkFloat amplitude ) = 0;
00030 
00032   virtual void setFrequency( StkFloat frequency );
00033 
00035   virtual void controlChange(int number, StkFloat value);
00036 
00038   unsigned int channelsOut( void ) const { return lastFrame_.channels(); };
00039 
00041   const StkFrames& lastFrame( void ) const { return lastFrame_; };
00042 
00044 
00052   StkFloat lastOut( unsigned int channel = 0 );
00053 
00055 
00058   virtual StkFloat tick( unsigned int channel = 0 ) = 0;
00059 
00061 
00068   virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
00069 
00070  protected:
00071 
00072   StkFrames lastFrame_;
00073 
00074 };
00075 
00076 inline void Instrmnt :: setFrequency( StkFloat frequency )
00077 {
00078   oStream_ << "Instrmnt::setFrequency: virtual setFrequency function call!";
00079   handleError( StkError::WARNING );
00080 }
00081 
00082 inline StkFloat Instrmnt :: lastOut( unsigned int channel )
00083 {
00084 #if defined(_STK_DEBUG_)
00085   if ( channel >= lastFrame_.channels() ) {
00086     oStream_ << "Instrmnt::lastOut(): channel argument is invalid!";
00087     handleError( StkError::FUNCTION_ARGUMENT );
00088   }
00089 #endif
00090 
00091   return lastFrame_[channel];
00092 }
00093 
00094 inline void Instrmnt :: controlChange( int number, StkFloat value )
00095 {
00096   oStream_ << "Instrmnt::controlChange: virtual function call!";
00097   handleError( StkError::WARNING );
00098 }
00099 
00100 } // stk namespace
00101 
00102 #endif

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