00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _GRMAGNITUDE_H_
00024 #define _GRMAGNITUDE_H_
00025
00026 #include <VrSigProc.h>
00027
00028 template<class iType, class oType>
00029 class GrMagnitude : public VrSigProc {
00030 public:
00031 GrMagnitude () : VrSigProc (1, sizeof (iType), sizeof (oType)) {}
00032
00033 virtual const char *name() { return "GrMagnitude"; }
00034
00035 virtual int work(VrSampleRange output, void *o[],
00036 VrSampleRange inputs[], void *i[]);
00037
00038 };
00039
00040 template<class iType, class oType> int
00041 GrMagnitude<iType,oType>::work(VrSampleRange output, void *ao[],
00042 VrSampleRange inputs[], void *ai[])
00043 {
00044 iType *i0 = ((iType **)ai)[0];
00045 oType *o0 = ((oType **)ao)[0];
00046 long size = output.size;
00047 long i;
00048
00049 for (i = 0; i < size; i++)
00050 o0[i] = (oType) abs (i0[i]);
00051
00052 return output.size;
00053 }
00054
00055
00056 #endif