Home   Information   Classes   Download   Usage   Mail List   Requirements   Links   Tutorial


Mesh2D.h

00001 /***************************************************/
00025 /***************************************************/
00026 
00027 #if !defined(__MESH2D_H)
00028 #define __MESH2D_H
00029 
00030 #include "Instrmnt.h"
00031 #include "OnePole.h"
00032 
00033 #define NXMAX ((short)(12))
00034 #define NYMAX ((short)(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(MY_FLOAT xFactor, MY_FLOAT yFactor);
00056 
00058   void setDecay(MY_FLOAT decayFactor);
00059 
00061   void noteOn(MY_FLOAT frequency, MY_FLOAT amplitude);
00062 
00064   void noteOff(MY_FLOAT amplitude);
00065 
00067   MY_FLOAT energy();
00068 
00070   MY_FLOAT tick();
00071 
00073   MY_FLOAT tick(MY_FLOAT input);
00074 
00076   void controlChange(int number, MY_FLOAT value);
00077 
00078  protected:
00079 
00080   MY_FLOAT tick0();
00081   MY_FLOAT tick1();
00082   void clearMesh();
00083 
00084   short NX, NY;
00085   short xInput, yInput;
00086   OnePole *filterX[NXMAX];
00087   OnePole *filterY[NYMAX];
00088   MY_FLOAT v[NXMAX-1][NYMAX-1]; // junction velocities
00089   MY_FLOAT vxp[NXMAX][NYMAX]; // positive-x velocity wave
00090   MY_FLOAT vxm[NXMAX][NYMAX]; // negative-x velocity wave
00091   MY_FLOAT vyp[NXMAX][NYMAX]; // positive-y velocity wave
00092   MY_FLOAT vym[NXMAX][NYMAX]; // negative-y velocity wave
00093 
00094   // Alternate buffers
00095   MY_FLOAT vxp1[NXMAX][NYMAX]; // positive-x velocity wave
00096   MY_FLOAT vxm1[NXMAX][NYMAX]; // negative-x velocity wave
00097   MY_FLOAT vyp1[NXMAX][NYMAX]; // positive-y velocity wave
00098   MY_FLOAT vym1[NXMAX][NYMAX]; // negative-y velocity wave
00099 
00100   int counter; // time in samples
00101 
00102 
00103 };
00104 
00105 #endif

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