my project starts working :-)
here is my wonderful mixing console ^^
http://img4.hostingpics.net/pics/468852Screen.jpg
with a magic interface!!
http://img4.hostingpics.net/pics/120775Button.jpg
it's just the beginning, but it works well.
the project in attached .zip if somebody wants to take a look.
The only strange things is :
- Flanger alone works
- Delay alone works
- both : doesn't works?
could it be a timing problem?
My sample rate is 44Khz
so 1thread at 100MIPS <=> 2270 operations between 2 samples.
Maybe with 2 effects, i have more than 2270 operations?
here is the main loop of my DSP thread
Code: Select all
while(1){
select /* If a value is available so input 3 value (i,j and the value) */
{
case c_matrix :> Temp :
IndexEffect=Temp;
c_matrix :> Temp;
IndexPreset = Temp;
c_matrix :> Temp;
Value = Temp;
effects_DSP[IndexEffect].presets[IndexPreset].val=Value;
break;
default :
break;
}
sampleIN_DSP = get_sample(c_in_card);
// FIFO fur buffering samples
buffer_in[countBuffer]=sampleIN_DSP;
sampleTMP=sampleIN_DSP;
high = 0;
low = 0x800000;
/* Gain IN */
{high,low} = macs(sampleTMP,intCoef[effects_DSP[VOLUME].presets[0].val], high, low);// 1.0 * 2^24 = 16777216
/* FLANGER */
/*
* effects_DSP[FLANGER].presets[3].val = 1 <=> frequency = 0.1Hz
* effects_DSP[FLANGER].presets[3].val = 10 <=> frequency = 1Hz
*/
if(countFlanger>= (int)(effects_DSP[FLANGER].presets[3].val*44/10)){
// because sample at 44000HZ and SINUS_PRECISION = 1000 so indexSinus++ every 44 loops for 1Hz frequency
countFlanger=0;
indexSinus=(indexSinus+1)%1000;
}
// Normal Flange
valSinus = LFO(indexSinus,effects_DSP[FLANGER].presets[1].val); // deep
{high,low} = macs(buffer_in[ Index(countBuffer- valSinus) ],intCoef[effects_DSP[FLANGER].presets[0].val], high, low); // 0.8 * 2^24 = 13421773
// Feedback
{high,low} = macs(buffer_out[ Index(countBuffer- valSinus) ],intCoef[effects_DSP[FLANGER].presets[2].val], high, low);
countFlanger++;
/* DELAY / mini reverb */
/////// !!!! \\\\\\
// When this part is added no more sound can be hear....
/* Normal Delay */
//{high,low} = macs(buffer_in[ Index(countBuffer- effects_DSP[DELAY].presets[0].val*40) ],intCoef[effects_DSP[DELAY].presets[1].val], high, low);// y(n)=tmp + x(n-time*40)*power
/* Feedback Delay */
//{high,low} = macs(buffer_out[ Index(countBuffer- effects_DSP[DELAY].presets[2].val*40) ],intCoef[effects_DSP[DELAY].presets[3].val], high, low);// y(n)=tmp + y(n-time*40)*power
/////// !!!! \\\\\\
sampleTMP = high << 8 | low >> 24;
/* Gain OUT */
//{high,low} = macs(sampleTMP,intCoef[effects_DSP[VOLUME].presets[0].val] , 0, 0x800000);// 1.0 * 2^24 = 16777216
//sampleTMP = high << 8 | low >> 24;
sampleOUT_DSP = sampleTMP;
give_sample(c_out_card,sampleOUT_DSP);
buffer_out[countBuffer]=sampleOUT_DSP;
countBuffer++;
if(countBuffer>=SIZE_BUFFER){
countBuffer=0;
}
}