Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

VrAmp.h

Go to the documentation of this file.
00001 /* -*- Mode: c++ -*- 
00002  *
00003  *  Copyright 1997 Massachusetts Institute of Technology
00004  * 
00005  *  Permission to use, copy, modify, distribute, and sell this software and its
00006  *  documentation for any purpose is hereby granted without fee, provided that
00007  *  the above copyright notice appear in all copies and that both that
00008  *  copyright notice and this permission notice appear in supporting
00009  *  documentation, and that the name of M.I.T. not be used in advertising or
00010  *  publicity pertaining to distribution of the software without specific,
00011  *  written prior permission.  M.I.T. makes no representations about the
00012  *  suitability of this software for any purpose.  It is provided "as is"
00013  *  without express or implied warranty.
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     //*o[0]++ = (oType)(*i[0]++ * g);
00044     o0[size] = (oType)(i0[size] * g);
00045     } 
00046   return output.size;
00047 }
00048 #endif

Generated on Tue Mar 15 23:48:04 2005 for GNU Radio by  doxygen 1.4.0