Hi! I see this Wah example and run it in DSK5510, but i don't understanding the full code!!! z[18] and d[18] are coeffs of a filter? they are store in b[6][3] and a[6][3], but in the code is not use all the elements of this two vectors!!! someone can help me to undestand this code???
Regards.
void main()
{ DSK5510_AIC23_CodecHandle hCodec;
Int16 leftsample, rightsample;
int i,j=0,k=0,s=0,samples=1000,order=2,filter=6;
double b[6][3],z[18]={ 0.072959657268267, 0.000000000000000,-0.072959657268267,
0.072959657268267, 0.000000000000000,-0.072959657268267, 0.136728735997319,
0.000000000000000,-0.136728735997319, 0.165910681040351, 0.000000000000000,-
0.165910681040351, 0.193599605930034, 0.000000000000000,-0.193599605930034,
0.292893218813453,-0.585786437626905, 0.292893218813453};
double a[6][3],d[18]={ 1.000000000000000,-1.836916476010566,
0.854080685463466,1.000000000000000,-1.768788101059395, 0.854080685463466,
1.000000000000000,-1.490469659645659, 0.726542528005361, 1.000000000000000,-
1.052992251962794, 0.668178637919299, 1.000000000000000,-0.387199211860068,
0.612800788139932, 1.000000000000000,-0.000000000000000, 0.171572875253810};
double w=0,m=0;
double y[3]={0,0,0};
double x[3]={0,0,0};
for(i=0;i<filter;i++)
{ for(j=0;j<order+1;j++)
{
b[i][j]=z[k];
a[i][j]=-d[k];
k++;
}
}
DSK5510_init();
hCodec = DSK5510_AIC23_openCodec(0,&config);
DSK5510_AIC23_setFreq(hCodec, DSK5510_AIC23_FREQ_16KHZ);
while(TRUE)
{
while (!DSK5510_AIC23_read16(hCodec,&leftsample));
while (!DSK5510_AIC23_read16(hCodec,&rightsample));
for(i=0;i<order;i++)
x[i]=x[i+1];
x[order]=leftsample;
w=0;
for(i=0;i<order-1;i++)
w += (b[j][i] * x[order-i]);
for(i=0;i<order;i++)
y[i]=y[i+1];
y[order]=0;
for(i=1;i<order+1;i++)
y[order]+= a[j][i] * y[order-i];
y[order]+=w;
leftsample=y[order];
while (!DSK5510_AIC23_write16(hCodec,0.05* leftsample));
while (!DSK5510_AIC23_write16(hCodec,0.05* leftsample));
s++;
if(s==samples)
{
s=0;
if(j==filter-1)
m=1;
If(j==0)
m=0;
if(m==0)
j++;
if(m==1)
j--;
}
}
DSK5510_AIC23_closeCodec(hCodec);
}