On Sat, Aug 10, 2002 at 06:32:55PM -0700, Martin Wolters wrote:
> short input = (short)(in[1]|(in[0] << 8));
> // ?? didn't test this configuration.
> // Don't know if byte order of CD data is changed
> // on different patforms.
I would assume that the byte order
Oh well. So now the "official" code looks like this:
#include
unsigned char * in; //point to buffer returned by cd_read_audio
#if __BYTE_ORDER == __LITTLE_ENDIAN
short input = (short)(in[0]|(in[1] << 8));
#else
short input = (short)(in[1]|(in[0] << 8));
// ?? didn'
Thanks everybody for the help. To bring the topic to an end, here is the code
that works:
#include
unsigned char * in; //point to buffer returned by cd_read_audio
#ifdef __LITTLE_ENDIAN
short input = (short)(in[0]|(in[1] << 8)); // PC
#else
short input = (short)(in[1]|(in[0]
On Sun, Aug 11, 2002 at 09:38:42AM +1000, Erik de Castro Lopo wrote:
> On Sat, 10 Aug 2002 18:32:36 -0500
> Mark Rages <[EMAIL PROTECTED]> wrote:
>
> > Ahh, I forgot CDDA is signed.
> >
> > Yes, I meant the u16 in the general sense that you picked up on.
> >
> > Well, you can try a byte-swap li
On Sat, 10 Aug 2002 18:32:36 -0500
Mark Rages <[EMAIL PROTECTED]> wrote:
> Ahh, I forgot CDDA is signed.
>
> Yes, I meant the u16 in the general sense that you picked up on.
>
> Well, you can try a byte-swap like this:
>
> #include // for swab()
> #include // for __LITTLE_ENDIAN macro
In my
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 >sample[i]=u16_buffer[i]; // impl
On Fri, 09 Aug 2002 18:18:44 -0700
Martin Wolters <[EMAIL PROTECTED]> wrote:
> I tried using something like the following to convert the data:
>
> float samples[samplesInBuffer];
> for(i=0;i int value = (buf[1] << 8) + (buf[0] << 16);
> sample[i] = ((float)(value/256))*scalefactor;
>
On Fri, 09 Aug 2002 18:18:44 -0700
Martin Wolters <[EMAIL PROTECTED]> wrote:
> I tried using something like the following to convert the data:
>
> float samples[samplesInBuffer];
> for(i=0;i int value = (buf[1] << 8) + (buf[0] << 16);
> sample[i] = ((float)(value/256))*scalefactor;
>
On Sat, Aug 10, 2002 at 04:05:40PM -0700, Martin Wolters 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 >sample[i]=u16_buffer[i]; // implicit conversio
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; isample[i]=u16_buffer[i]; // implicit conversion to float
Well, that doesn't seem to work for me. If I use "s16" instead, it s
On Sat, Aug 10, 2002 at 02:07:20PM -0500, Mark Rages wrote:
(cut)
>Well, I've never had any problems with cdparanoia, but the web page
>is full of Real Soon Now hype for "Paranoia IV" which will have a
>library and API for others to use.
(cut)
:) I guess they forgot then
>I guess the Xiph boys h
On Sat, Aug 10, 2002 at 08:09:49PM +0200, Vincent Touquet wrote:
> On Sat, Aug 10, 2002 at 11:49:14AM -0500, Mark Rages wrote:
> >http://www.xiph.org/paranoia
> >What's going on with that project? The web page has been stagnant for
> >two years.
>
> Feature complete / no more bugs ? :)
>
> regar
On Sat, Aug 10, 2002 at 11:49:14AM -0500, Mark Rages wrote:
>http://www.xiph.org/paranoia
>What's going on with that project? The web page has been stagnant for
>two years.
Feature complete / no more bugs ? :)
regards
v
On Fri, Aug 09, 2002 at 06:18:44PM -0700, Martin Wolters wrote:
> I am trying to read out data from a CDDA and convert it into float (on
> Linux x86). The data from the CD is returned in an unsigned char buffer.
> That code looks something like this:
>
> int cd_read_audio(int cdrom_fd, int lba
14 matches
Mail list logo