Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   FAQ   Tutorial


Mesh2D.h

00001 /***************************************************/
00025 /***************************************************/
00026 
00027 #ifndef STK_MESH2D_H
00028 #define STK_MESH2D_H
00029 
00030 #include "Instrmnt.h"
00031 #include "OnePole.h"
00032 
00033 const short NXMAX = 12;
00034 const short NYMAX = 12;
00035 
00036 class Mesh2D : public Instrmnt
00037 {
00038  public:
00040   Mesh2D(short nX, short nY);
00041 
00043   ~Mesh2D();
00044 
00046   void clear(); 
00047 
00049   void setNX(short lenX);
00050 
00052   void setNY(short lenY);
00053 
00055   void setInputPosition(StkFloat xFactor, StkFloat yFactor);
00056 
00058   void setDecay(StkFloat decayFactor);
00059 
00061   void noteOn(StkFloat frequency, StkFloat amplitude);
00062 
00064   void noteOff(StkFloat amplitude);
00065 
00067   StkFloat energy();
00068 
00070   StkFloat inputTick( StkFloat input );
00071 
00073   void controlChange(int number, StkFloat value);
00074 
00075  protected:
00076 
00077   StkFloat computeSample( void );
00078 
00079   StkFloat tick0();
00080   StkFloat tick1();
00081   void clearMesh();
00082 
00083   short NX_, NY_;
00084   short xInput_, yInput_;
00085   OnePole  filterX_[NXMAX];
00086   OnePole  filterY_[NYMAX];
00087   StkFloat v_[NXMAX-1][NYMAX-1]; // junction velocities
00088   StkFloat vxp_[NXMAX][NYMAX];   // positive-x velocity wave
00089   StkFloat vxm_[NXMAX][NYMAX];   // negative-x velocity wave
00090   StkFloat vyp_[NXMAX][NYMAX];   // positive-y velocity wave
00091   StkFloat vym_[NXMAX][NYMAX];   // negative-y velocity wave
00092 
00093   // Alternate buffers
00094   StkFloat vxp1_[NXMAX][NYMAX];  // positive-x velocity wave
00095   StkFloat vxm1_[NXMAX][NYMAX];  // negative-x velocity wave
00096   StkFloat vyp1_[NXMAX][NYMAX];  // positive-y velocity wave
00097   StkFloat vym1_[NXMAX][NYMAX];  // negative-y velocity wave
00098 
00099   int counter_; // time in samples
00100 };
00101 
00102 #endif

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