Re: Wav to Ogg Vorbis conversion

"[email protected]" <[email protected]> Thu, 10 Mar 2011 09:15:13 -0800
Newsgroups gmane.comp.multimedia.ogg.vorbis.devel
Message-ID <[email protected]>
> Could you please tell me what float** buffer is needed for (I don't see
> it used anywhere).

It's needed to pass the samples to libvorbis for encoding.
It's used in the libvorbis code. It was returned by vorbis_analysis_buffer
for the client code to write samples in, so libvorbis has kept a reference to
this buffer internally, and will be using it afterwards.

>       for(i=0;i<bytes/4;i++){
>
>         buffer[0][i]=((readbuffer[i*4+1]<<8)|
>
>                       (0x00ff&(int)readbuffer[i*4]))/32768.f;
>
>         buffer[1][i]=((readbuffer[i*4+3]<<8)|
>
>                       (0x00ff&(int)readbuffer[i*4+2]))/32768.f;
>
>       }

This seems to be converting 16 bit stereo integer samples to float samples.

> And where does the actual encoding happens?

In the libvorbis code, probably _blockout, but it should not matter for you
if you're using the libvorbis API.

> Maybe you could recommend some tutorial to understand how this works?

http://www.bluishcoder.co.nz/2009/06/26/decoding-vorbis-files-with-libvorbis.html