tmpAin=Ain;
OutSignal=0;
BigOutSignal=0;
//moving circular buffer indexing
if (i!=bufferLength-1)
i++;
else
i=0;
//if the effect is an ECHO we need a feedback buffer
if(effectIndex!=Echo)
dataBuffer[i]=tmpAin;
else
{
//lcd_putsf("echo");
BigOutSignal=((int)tmpAin) + ( (int)mult(dataBuffer[delay[0]],echoVol[propertyIndex[effectIndex]])
);//delete tmpAin when we have switch.
dataBuffer[i]=( ((char)(BigOutSignal))>>3 ) ;
}
switch(effectIndex)
{
case Reverb:
switch(propertyIndex[effectIndex])
{
case 0: //Church
BigOutSignal= (( (int) (multi(dataBuffer[delay[0]],2))+ ((int)multi(dataBuffer[delay[1]],1))+
((int)multi(dataBuffer[delay[2]],2)) + ((int)multi(dataBuffer[delay[3]],1))+
((int)multi(dataBuffer[delay[4]],0)) + ((int)dataBuffer[delay[5]]) ) ) ;
break;
case 1: //Auditorium
BigOutSignal= ((int)multi(dataBuffer[delay[2]],2)) + ((int)multi(dataBuffer[delay[3]],1))+
((int)multi(dataBuffer[delay[4]],0)) + ((int)dataBuffer[delay[5]]) ;
break;
case 2: //Large Room
BigOutSignal= ( (int)multi(dataBuffer[delay[3]],1))+ ((int)multi(dataBuffer[delay[4]],0))
+ ((int)dataBuffer[delay[5]]) ;
break;
case 3://Small Room
BigOutSignal= ((int)dataBuffer[delay[2]]) +( (int)multi(dataBuffer[delay[3]],1))
;
break;
}//end switch
break;
case Distortion:
if(tmpAin>HighVal[propertyIndex[effectIndex]])
BigOutSignal=HighVal[propertyIndex[effectIndex]];
else
BigOutSignal=tmpAin;
break;
case Tremolo:
k++;
if(k==freq[propertyIndex[effectIndex]])
{
k=0;
if(direction ==1)//countingup
vol++;
else
vol--;
if(vol==maxVol)
direction=0;//1 is to count up 0 counts down
else if (vol==minVol)
direction=1;
}
BigOutSignal= ((int)mult(tmpAin,vol));//+OutSignal;sinArr[time]
break;