Re: [Plib-users] Toying with Ogg
Brought to you by:
sjbaker
From: Cameron M. <li...@to...> - 2001-06-29 05:52:15
|
* sjb...@ai... [2001.06.29 00:20]: > Cameron Moore wrote: > > > I'm playing around with Ogg Vorbis at the moment, and I'm stuck trying > > to figure out how to use it with plib. My first goal is to use > > slSample( Uchar *buff, int leng ) to play the stream. > > Isn't that going to be a rather large file though? If by 'file' you mean the .ogg file, then why does it have to be large? What are you getting at? > > The problem for this newbie is that libvorbisfile converts the .ogg > > stream into a char[] buffer (PCM) but plib wants a Uchar* buffer. Is > > there a trick to converting between these datatypes? > > Well, it depends on how Ogg translates that into a voltage. > > If it's signed char, then probably +127 is the max positive, zero is > zero and -128 is max negative...as you'd expect. > > SL is using 255 is max positive, 128 is zero volts and 0 is max negative, > so, looking at the bit patterns: > > volts Ogg SL > +max 01111111 11111111 > 00111111 10111111 > zero 00000000 10000000 > 11000000 01000000 > -max 10000000 00000000 > > ...so you just need to flip the topmost bit of each byte... > > slByte = oggByte ^ 0x80 ; > > Tadaaa! You rock. > But I think you really need to find a way for Ogg's output to continuously > churn out bytes and feed them into SL...that's *hard* to do...but 2.4 Megabytes > per minute of music is a heck of a lot of memory to burn. That's probably more work than I want to do, but we'll see. 8-) And about the mem usage, how is ogg harder on memory than wav or au? IIRC, Q3A uses MP3s for some of it's intro music and doesn't seem to have any problems with it. -- Cameron Moore |