00001
00002
00003
00004
00005
00006
00007
00008 #include "afw.h"
00009 #include "ad7998.h"
00010 #include "dline.h"
00011 #include "osc.h"
00012
00013 namespace afw{
00014
00015
00016
00017
00018
00019 const int mHz = (int)(65536.0*65536.0/48000.0/1000.0);
00020
00021
00022
00023
00024
00025 shortfract * lfotemp;
00026
00027
00028
00029
00030
00031 osc::COscillator * lfo ;
00032
00033
00034
00035
00036
00037 const unsigned int maxShift = 1024;
00038
00039
00040
00041
00042 dline::CShifter * shifter;
00043
00044
00045
00046
00047
00048
00049
00050 void initProcessData(int count)
00051 {
00052 shifter = new dline::CShifter( maxShift );
00053 lfo = new osc::CTableLookup(1000*mHz);
00054 }
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 void processData(
00088 const shortfract leftIn[],
00089 const shortfract rightIn[],
00090 shortfract leftOut[],
00091 shortfract rightOut[],
00092 int count
00093 )
00094 {
00095 shortfract freq, span;
00096 static shortfract shifted;
00097
00098 freq = ad7998::getValue(ad7998::Vin1);
00099 span = ad7998::getValue(ad7998::Vin2);
00100
00101 lfo->setFreq( ( freq.v >> 5 ) * mHz );
00102 lfo->run( lfotemp, count );
00103
00104
00105 for ( int i=0; i<count; i++ ){
00106
00107 shortfract input = leftIn[i]*(shortfract)0.5 + shifted * (shortfract)0.5;
00108 shifter->run( &input, &shifted, 1, ((lfotemp[i]*(shortfract)0.5r+(shortfract)0.5r) * span ).v>>7 );
00109 leftOut[i] = rightOut[i] = shifted;
00110 }
00111
00112 }
00113
00114 };
00115
00116