Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# Filter.h

    00001 #ifndef STK_FILTER_H
    00002 #define STK_FILTER_H
    00003
    00004 #include "Stk.h"
    00005 #include <vector>
    00006
    00007 namespace stk {
    00008
    00009 /***************************************************/
    00019 /***************************************************/
    00020
    00021 class Filter : public Stk
    00022 {
    00023 public:
    00025   Filter( void ) { gain_ = 1.0; channelsIn_ = 1; lastFrame_.resize( 1, 1, 0.0 ); };
    00026
    00028   unsigned int channelsIn( void ) const { return channelsIn_; };
    00029
    00031   unsigned int channelsOut( void ) const { return lastFrame_.channels(); };
    00032
    00034   virtual void clear( void );
    00035
    00037
    00041   void setGain( StkFloat gain ) { gain_ = gain; };
    00042
    00044   StkFloat getGain( void ) const { return gain_; };
    00045
    00047   const StkFrames& lastFrame( void ) const { return lastFrame_; };
    00048
    00050
    00058   virtual StkFrames& tick( StkFrames& frames, unsigned int channel = 0 ) = 0;
    00059
    00060 protected:
    00061
    00062   unsigned int channelsIn_;
    00063   StkFrames lastFrame_;
    00064
    00065   StkFloat gain_;
    00066   std::vector<StkFloat> b_;
    00067   std::vector<StkFloat> a_;
    00068   StkFrames outputs_;
    00069   StkFrames inputs_;
    00070
    00071 };
    00072
    00073 inline void Filter :: clear( void )
    00074 {
    00075   unsigned int i;
    00076   for ( i=0; i<inputs_.size(); i++ )
    00077     inputs_[i] = 0.0;
    00078   for ( i=0; i<outputs_.size(); i++ )
    00079     outputs_[i] = 0.0;
    00080   for ( i=0; i<lastFrame_.size(); i++ )
    00081     lastFrame_[i] = 0.0;
    00082 }
    00083
    00084 } // stk namespace
    00085
    00086 #endif

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