[vorbis-dev] windows buffering example

Matthijs Laan matthijsln at xs4all.nl
Wed Apr 4 10:06:38 PDT 2001



At 19:41 3-4-01, you wrote:
>From: BILL OATMAN
>
>I have seen several requests for windows specific example code.
>This is another.  What I am looking for is a example of how to play
>a large ogg file in windows by using a multi-buffering technique.  That is,
>reading and decoding a chunk of the ogg file and handing it off to
>windows (directsound maybe) meanwhile buffering up the next chunk to
>play etc.  Assume the ogg file decompressed will be way too large
>to hold in memory all at once.  If anyone has any code they are willing
>to share that does this, please post it.  Otherwise I will probably take
>the time
>to do it myself (and post it here).

I have written some code for WaveOut, it's really simple (altough I found the
Windows WaveOut API help even worse than the Ogg Vorbis help ;-). You just open
the wave device, write a couple of buffers, and when a buffer is done playing
(setup a callback for that when opening the wave device) you just write 
another one.
All the buffering is handled nicely by Windows (as it should).

For playing Ogg Vorbis files, just do an ov_open_callbacks, setup your 
callbacks and
then just call ov_read repeatedly until your buffer is full when you need 
the next sound
buffer.

I could give you some example code, but it's written in ObjectPascal 
(Delphi), and I
assume you're using C. Well it's very easy to read anyway so if you're 
still interested...

Matthijs

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis-dev mailing list