[Vorbis-dev] Wav to Ogg Vorbis conversion

ogg.k.ogg.k at googlemail.com ogg.k.ogg.k at googlemail.com
Thu Mar 10 09:15:13 PST 2011


> 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


More information about the Vorbis-dev mailing list