00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
#ifndef _GRWEAVERMODHEAD_H_
00023
#define _GRWEAVERMODHEAD_H_
00024
00025
#include <VrInterpolatingSigProc.h>
00026
00038
template<
class iType,
class oType>
00039 class GrWeaverModHead :
public VrInterpolatingSigProc<iType,oType> {
00040
public:
00041 GrWeaverModHead (
int interp_factor) :
00042
VrInterpolatingSigProc<
iType,
oType>(2, interp_factor){}
00043
00044 virtual const char *
name () {
return "GrWeaverModHead"; }
00045
00046
virtual int work (
VrSampleRange output,
void *o[],
00047
VrSampleRange inputs[],
void *i[]);
00048
00049 void initialize () {
setOutputSize (interp * 4); }
00050 };
00051
00052
00053
template<
class iType,
class oType>
int
00054 GrWeaverModHead<iType,oType>::work (
VrSampleRange output,
void *ao[],
00055
VrSampleRange inputs[],
void *ai[])
00056 {
00057
iType *i = ((
iType **) ai)[0];
00058
oType *oI = ((
oType **) ao)[0];
00059
oType *oQ = ((
oType **) ao)[1];
00060
int size = output.
size;
00061
iType input_symbol;
00062
00063
static const iType nco[4][2] = {
00064
00065 { 1, 0 },
00066 { 0, 1 },
00067 { -1, 0 },
00068 { 0, -1 }
00069 };
00070
00071 assert ((inputs[0].index & 0x3) == 0);
00072
00073
for (
int insamp = 0; insamp < size/interp; insamp++){
00074 input_symbol = i[insamp];
00075 *oI++ = input_symbol * nco[insamp & 0x3][0];
00076 *oQ++ = input_symbol * nco[insamp & 0x3][1];
00077
for (
int outsamp = 1; outsamp < interp; outsamp++){
00078 *oI++ = 0;
00079 *oQ++ = 0;
00080 }
00081 }
00082
return output.
size;
00083 }
00084
00085
#endif