[SDL] ogg as mixchunk?

Ryan C. Gordon icculus at icculus.org
Sat Jan 5 23:48:52 PST 2008


>> can anyone guide me as to how to load / convert a ogg file into a mix 
>> chunk? i
>> have done a breif poking around for assistance on the web, but afaict ogg is
>> only loadable as a music, er, chunk.

The increasingly-misnamed Mix_LoadWAV() will handle them. Just pass a 
buffer of .ogg data instead of a .buffer of .wav, and it'll do the right 
thing with it.

> and at some point i will be wanting to store my sound files as oggs in 
> a header
> file so it is part of a final binary... and nobody is talking me out of it,
> except the person that explains it isnt possible ;)

People say they want to do this, from time to time, and I still can't be 
convinced there is _any_ scenario where that's a good idea.

If you want to have one self-contained .exe, append a .zip file to it 
and open yourself at runtime. That lets you not keep all your data in 
static memory (after all, that .ogg is wasted RAM once you decode it), 
lets you be more nimble about adding and changing out the data, and is 
just less messy than the nasty-looking header you're going to have in 
revision control otherwise.

But, hey, do what you like.

--ryan.




More information about the SDL mailing list