Hi All
I am working on audio processing using the DSK C5510. Initially I open a file using fopen, fread commands and do the processing after which I write back into another file using fwrite say its called output.wav
Now I want to play this output.wav in my program so that can listen using the peripherals in DSK . Can some one suggest me a way of how to configure it from the program.
I have tried using the following code but didnt work. I am struck in developing the algorithm .
#include "tonecfg.h"
#include "dsk5510.h"
#include "dsk5510_aic23.h"
#include "stdio.h"
#include "stdlib.h"
DSK5510_AIC23_Config config = { \
0x0017, /* 0 DSK5510_AIC23_LEFTINVOL Left line input channel volume */ \
0x0017, /* 1 DSK5510_AIC23_RIGHTINVOL Right line input channel volume */\
0x01f9, /* 2 DSK5510_AIC23_LEFTHPVOL Left channel headphone volume */ \
0x01f9, /* 3 DSK5510_AIC23_RIGHTHPVOL Right channel headphone volume */ \
0x0011, /* 4 DSK5510_AIC23_ANAPATH Analog audio path control */ \
0x0000, /* 5 DSK5510_AIC23_DIGPATH Digital audio path control */ \
0x0000, /* 6 DSK5510_AIC23_POWERDOWN Power down control */ \
0x0043, /* 7 DSK5510_AIC23_DIGIF Digital audio interface format */ \
0x008d, /* 8 DSK5510_AIC23_SAMPLERATE Sample rate control */ \
0x0001 /* 9 DSK5510_AIC23_DIGACT Digital interface activation */ \
};
FILE *fpOut;
void main()
{
DSK5510_AIC23_CodecHandle hCodec;
long size;
int sample;
Int16 *c_play;
DSK5510_init();
hCodec = DSK5510_AIC23_openCodec(0, &config);
DSK5510_AIC23_setFreq(hCodec,DSK5510_AIC23_FREQ_8KHZ);
fpOut = fopen("G://workouts//NR//data//nrvelu.wav","r");
fseek(fpOut,0,SEEK_END);
size = ftell(fpOut);
fread(&c_play,sizeof(c_play),1,fpOut);
fseek(fpOut,0,SEEK_SET);
for (sample = 0; sample < size ; sample++)
{
while (!DSK5510_AIC23_write16(hCodec, *c_play)); //left channel
while (!DSK5510_AIC23_write16(hCodec, *c_play++)); // right channel
}
DSK5510_AIC23_closeCodec(hCodec);
fclose(fpOut);
}
I am not sure how to read the raw file and listen using the headphones from the line out.