Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   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 tick();
00071 
00073   StkFloat tick(StkFloat input);
00074 
00076   StkFloat *tick(StkFloat *vector, unsigned int vectorSize);
00077 
00079 
00085   StkFrames& tick( StkFrames& frames, unsigned int channel = 1 );
00086 
00088   void controlChange(int number, StkFloat value);
00089 
00090  protected:
00091 
00092   StkFloat tick0();
00093   StkFloat tick1();
00094   void clearMesh();
00095 
00096   short NX_, NY_;
00097   short xInput_, yInput_;
00098   OnePole  filterX_[NXMAX];
00099   OnePole  filterY_[NYMAX];
00100   StkFloat v_[NXMAX-1][NYMAX-1]; // junction velocities
00101   StkFloat vxp_[NXMAX][NYMAX];   // positive-x velocity wave
00102   StkFloat vxm_[NXMAX][NYMAX];   // negative-x velocity wave
00103   StkFloat vyp_[NXMAX][NYMAX];   // positive-y velocity wave
00104   StkFloat vym_[NXMAX][NYMAX];   // negative-y velocity wave
00105 
00106   // Alternate buffers
00107   StkFloat vxp1_[NXMAX][NYMAX];  // positive-x velocity wave
00108   StkFloat vxm1_[NXMAX][NYMAX];  // negative-x velocity wave
00109   StkFloat vyp1_[NXMAX][NYMAX];  // positive-y velocity wave
00110   StkFloat vym1_[NXMAX][NYMAX];  // negative-y velocity wave
00111 
00112   int counter_; // time in samples
00113 };
00114 
00115 #endif

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