On Sat, 10 Aug 2002 16:05:40 -0700 Martin Wolters <[EMAIL PROTECTED]> wrote:
> On Saturday 10 August 2002 09:49, Mark Rages wrote: > > Anyhow, try something like this: > > > > u16 *u16_buffer = (u16 *)buf; > > float sample[samplesInBuffer] > > > > for (i=0; i<samplesInBuffer; i++) > > sample[i]=u16_buffer[i]; // implicit conversion to float > > Well, that doesn't seem to work for me. If I use "s16" instead, it sounds a > little more like music (I actually can recognize a song). But it's far from > being undistored. I am wondering, if a byte-swap might be required and how to > do that. I'm pretty sure that the audio data is signed. Seem my reponse to your ealier post. > PS.: I assume "u16" is equivalent to "__u16" as defined in <linux/types.h>, > correct? I now use the following lines: > #include <linux/types.h> > #define s16 __s16 > #define u16 __u16 You really shouldn't be using header files like <linux/*.h> as they are really only for kernel related code. Instead #include <stdint.h> which defines things like int16_t and uint16_t which are part of the ISO 1999 C Standard. Make things a little more portable. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo [EMAIL PROTECTED] (Yes it's valid) +-----------------------------------------------------------+ With careful modifications to the case of the Win 3.1 machine, it can be hollowed out and turned into a Crab-pot. Once tossed into the nearest river or estuary, you will be amazed at it's improved performance. Where once it produced very little of anything, now you'll have mud crabs. --OzCableguy (as posted to bigpond.broadband.tech.win)