Home Information Classes Download Usage Mail List Requirements Links FAQ Tutorial

# Mesh2D.h

    00001 #ifndef STK_MESH2D_H
    00002 #define STK_MESH2D_H
    00003
    00004 #include "Instrmnt.h"
    00005 #include "OnePole.h"
    00006
    00007 namespace stk {
    00008
    00009 /***************************************************/
    00033 /***************************************************/
    00034
    00035 const short NXMAX = 12;
    00036 const short NYMAX = 12;
    00037
    00038 class Mesh2D : public Instrmnt
    00039 {
    00040  public:
    00042   Mesh2D( short nX, short nY );
    00043
    00045   ~Mesh2D( void );
    00046
    00048   void clear( void );
    00049
    00051   void setNX( short lenX );
    00052
    00054   void setNY( short lenY );
    00055
    00057   void setInputPosition( StkFloat xFactor, StkFloat yFactor );
    00058
    00060   void setDecay( StkFloat decayFactor );
    00061
    00063   void noteOn( StkFloat frequency, StkFloat amplitude );
    00064
    00066   void noteOff( StkFloat amplitude );
    00067
    00069   StkFloat energy( void );
    00070
    00072   StkFloat inputTick( StkFloat input );
    00073
    00075   void controlChange( int number, StkFloat value );
    00076
    00078   StkFloat tick( unsigned int channel = 0 );
    00079
    00080  protected:
    00081
    00082   StkFloat tick0();
    00083   StkFloat tick1();
    00084   void clearMesh();
    00085
    00086   short NX_, NY_;
    00087   short xInput_, yInput_;
    00088   OnePole  filterX_[NXMAX];
    00089   OnePole  filterY_[NYMAX];
    00090   StkFloat v_[NXMAX-1][NYMAX-1]; // junction velocities
    00091   StkFloat vxp_[NXMAX][NYMAX];   // positive-x velocity wave
    00092   StkFloat vxm_[NXMAX][NYMAX];   // negative-x velocity wave
    00093   StkFloat vyp_[NXMAX][NYMAX];   // positive-y velocity wave
    00094   StkFloat vym_[NXMAX][NYMAX];   // negative-y velocity wave
    00095
    00096   // Alternate buffers
    00097   StkFloat vxp1_[NXMAX][NYMAX];  // positive-x velocity wave
    00098   StkFloat vxm1_[NXMAX][NYMAX];  // negative-x velocity wave
    00099   StkFloat vyp1_[NXMAX][NYMAX];  // positive-y velocity wave
    00100   StkFloat vym1_[NXMAX][NYMAX];  // negative-y velocity wave
    00101
    00102   int counter_; // time in samples
    00103 };
    00104
    00105 } // stk namespace
    00106
    00107 #endif

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