[vorbis-dev] Reading OGG embedded in a pack file

Ralph Giles giles at xiph.org
Mon May 3 23:22:30 PDT 2004



On Tue, May 04, 2004 at 03:17:02PM +1000, Michael Smith wrote:

> It sounds like the problem if SDL_mixer - if it expects (and provides NO other 
> alternative) a single buffer for the entire stream, then either it's just 
> badly designed, or it's a poor fit for what you're trying to do. The other 
> possibility is that there _is_ some other way to get data into SDL_mixer - if 
> there is, then you should probably be using that. 

SDL_mixer isn't very sophisticated. It follows the older game sound-effects model
of loading a bunch of short samples which can be triggered and mixed into the
output. It's not clear from the documentation, but it probably expects to hold
the entire sample in ram, a legacy from the time when any load or decode at all
introduced unacceptable latency in playback.

There is a separate set of API calls for playing a background music track that
may use streaming techniques when possible.

It should be noted that SDL_Mixer has native support for loading Ogg Vorbis samples.
The documentation says you can pass an Ogg Vorbis filename to a number of the LoadWAV
calls and it will handle them transparently. This doesn't help directly with your
packed data format, but another possible approach is to the Mix_LoadWAV_RW with 
an SDL_RWops callback set to feed it the data similar to what you're already doing
with libvorbisfile.

Or, you can give up an write your own mixer on top of basic SDL_Audio, which of course
gives you much more control of how the data is handled. I suspect this is more
the situation Mike was assuming you where in in the first place.

FWIW,
 -r
--- >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