00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _VRAMP_H_
00019 #define _VRAMP_H_
00020
00021 #include <VrSigProc.h>
00022
00023 template<class iType,class oType>
00024 class VrAmp : public VrSigProc {
00025 protected:
00026 float g;
00027 public:
00028 virtual const char *name() { return "VrAmp"; }
00029 virtual int work(VrSampleRange output, void *o[],
00030 VrSampleRange inputs[], void *i[]);
00031 void setGain(float gn) {g = gn;}
00032 VrAmp(float gn = 1.0) :VrSigProc(1,sizeof(iType),sizeof(oType)),g(gn) { }
00033 };
00034
00035 template<class iType,class oType> int
00036 VrAmp<iType,oType>::work(VrSampleRange output, void *o[],
00037 VrSampleRange inputs[], void *i[])
00038 {
00039 iType *i0 = ((iType **)i)[0];
00040 oType *o0 = ((oType **)o)[0];
00041 int size = output.size;
00042 while (size-- > 0) {
00043
00044 o0[size] = (oType)(i0[size] * g);
00045 }
00046 return output.size;
00047 }
00048 #endif