VrMixer.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
#ifndef _VRMIXER_H_
00040
#define _VRMIXER_H_
00041
00042
#include <VrSigProc.h>
00043
00044
template<
class iType,
class oType>
00045 class VrMixer :
public VrSigProc {
00046
protected:
00047 double freq;
00048 double arg;
00049 double argInc;
00050
void evaluate(
int n);
00051
virtual void initialize();
00052
public:
00053 virtual const char *
name() {
return "VrMixer"; }
00054
virtual int work(
VrSampleRange output,
void *ao[],
00055
VrSampleRange inputs[],
void *ai[]);
00056 VrMixer(
double f) :
VrSigProc(1,sizeof(
iType),sizeof(
oType)),
freq(f),
arg(0) { }
00057 };
00058
00059
template<
class iType,
class oType>
int
00060 VrMixer<iType,oType>::work(
VrSampleRange output,
void *ao[],
00061
VrSampleRange inputs[],
void *ai[])
00062 {
00063
iType **i = (
iType**)ai;
00064
oType **o = (
iType**)ao;
00065
int size = output.
size;
00066
while(size -- > 0) {
00067 *o[0]++ = (
oType) (*i[0]++ *
sin(
arg));
00068
arg +=
argInc;
00069 }
00070
return output.
size;
00071 }
00072
00073
template<
class iType,
class oType>
void
00074 VrMixer<iType,oType>::initialize()
00075 {
00076
argInc = 2*M_PI*
freq*(1 / (
double)
getInputSamplingFrequencyN(0));
00077 }
00078
#endif
Generated on Wed Aug 4 02:22:05 2004 for GNU Radio by
1.3.8