00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
#ifndef _GRSSBMOD_H_
00025
#define _GRSSBMOD_H_
00026
00027
#include <VrSigProc.h>
00028
#include <VrComplex.h>
00029
#include <gr_nco.h>
00030
00031
template<
class oType>
00032 class GrSSBMod :
public VrSigProc {
00033
private:
00034 gr_nco<float,float> d_nco;
00035 double d_gain;
00036
public:
00037
GrSSBMod (
double freq,
double gain);
00038
00039 virtual const char *
name() {
return "GrSSBMod"; }
00040
virtual int work(
VrSampleRange output,
void *o[],
00041
VrSampleRange inputs[],
void *i[]);
00042
00043
00044 void set_freq (
double freq) {
00045 cerr <<
"set freq to " << freq << endl;
00046
d_nco.
set_freq (freq);
00047 };
00048
00049 void set_gain (
double g) {
d_gain = g; };
00050 };
00051
00052
template<
class oType>
int
00053 GrSSBMod<oType>::work(
VrSampleRange output,
void *ao[],
00054
VrSampleRange inputs[],
void *ai[])
00055 {
00056
VrComplex **i = (
VrComplex **)ai;
00057
oType **o = (
oType **)ao;
00058
int size = output.
size;
00059
00060
for(
int x = 0; x < size; x++)
00061 {
00062 *o[0]++ = (
oType) (
d_gain * (i[0]->
real() *
d_nco.
cos()
00063 + i[0]->imag() *
d_nco.
sin() ));
00064 i[0]++;
00065
d_nco.
step();
00066 }
00067
return output.
size;
00068 }
00069
00070
template<
class oType>
00071 GrSSBMod<oType>::GrSSBMod (
double freq,
double gain)
00072 :
VrSigProc(1, sizeof(
VrComplex), sizeof(
oType)), d_gain (gain)
00073 {
00074
00075
d_nco.
set_freq (freq);
00076 }
00077
00078
#endif