Hi,

I'm trying to play 32-bit stereo and 24 bit stereo WAV files. As audio driver 
can only support 16-bit, so I use below conversion functions. The ouput seems 
to be fine but with lot of noise. Any ideas ?


static void convert_24_to_16sle(short *out, unsigned long len, char *in)

{

    int                 nr_of_samples;

    int                 i;



    nr_of_samples = len / 3;



    for (i = 0; i < nr_of_samples; i++) {

        *out = ((short)in[1] | ((short)in[2] << 8)); 

        out++;

        in += 3;

    }

}



static void convert_32_to_16sle(short *out, unsigned long len, char *in)

{

    int                 nr_of_samples;

    int                 i;



    nr_of_samples = len / 4;



    for (i = 0; i < nr_of_samples; i++) {

        *out = (short)(*((unsigned long *)in) >> 8);

        out++;

        in += 4;

    }

}






 
____________________________________________________________________________________
Bored stiff? Loosen up... 
Download and play hundreds of games for free on Yahoo! Games.
http://games.yahoo.com/games/front
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to