Ogg as mixchunk?

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.

apologies if i have missed the big neon lights telling me how to achieve this.

i have seen games that use oggs as sound files but am not sure if they are
loaded and then unencoded as ogg each time they play? if so then i think this
would be to proccesor intensive. and not so hot for low powered devices.

I have a few long sounds i want to use as a semi backing noise in my game, but
would prefer to use mixchunks, but would also prefer to use ogg’s as the
original file format to keep disk size down.

any help, tips, whatever please…

Quoting neil at cloudsprinter.com:

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.

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 :wink:

neil at cloudsprinter.com wrote:

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.

apologies if i have missed the big neon lights telling me how to achieve this.

i have seen games that use oggs as sound files but am not sure if they are
loaded and then unencoded as ogg each time they play? if so then i think this
would be to proccesor intensive. and not so hot for low powered devices.

I have a few long sounds i want to use as a semi backing noise in my game, but
would prefer to use mixchunks, but would also prefer to use ogg’s as the
original file format to keep disk size down.

any help, tips, whatever please…

Hi, I don’ t know if this will be of any help, but I load ogg sound
affects using SDL_mixer by calling Mix_LoadWAV(). It returns a
Mix_Chunk*. I load all of my sound files during the init phase, and
store the Mix_Chunks in a map. Then play them as I need them. I recently
had to compile SDL_mixer and libvorbis for linux and windows so I may be
able to help if you run into any problems getting those installed.

Jim

can anyone guide me as to how to load / convert a ogg file into a mix chunk?

any help, tips, whatever please…

Hi, I don’ t know if this will be of any help, but I load ogg sound
affects using SDL_mixer by calling Mix_LoadWAV(). It returns a
Mix_Chunk*.

ok… i thought i had tried this and crashed… i’ll try again… the
whole WAV bit
kinda throws me off.

I load all of my sound files during the init phase, and
store the Mix_Chunks in a map.

i dont know what you mean hear by map… could you elaborate a bit?

Then play them as I need them. I recently
had to compile SDL_mixer and libvorbis for linux and windows so I may be
able to help if you run into any problems getting those installed.

when i get the chance i am curretntly testing RISC OS versions of various SDL
and related libaries… there isnt much optimisation going on behind the scenes
and i am not of the skills to do so, last time i attempted to test OGG playing
as music it was a bit painful… but that was on a 245mhz StrongARM chip.

so that guy that was asking about ARM code in SDL… RISC OS needs you :wink:

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 :wink:

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.

All of this is true, but embedding a zip file into the EXE (and
similar strategies) is fairly nonportable. Not only do you have to
write OS-specific code for it, but on UNIX-likes in particular it’s
fairly complex and fragile OS-specific code. (I wouldn’t know about
Windows.)
Come to think of it, didn’t someone mention a library that
encapsulates this a while back?
The header embedding method does have its uses. Recently, for
instance, I used it to store the default ROM of a simulator for a
16-bit fixed-word computer. If the user provided an alternate ROM
image it overwrote the compiled-in ROM. The ROM’s size in the
architecture is fixed (at a humongous 180Kiwords) so it didn’t need to
be resizable. It also had the bonus of allowing me to program test
ROMs using preprocessor macros instead of bullying the assembler into
working early.
It occurs to me that you could avoid memory wastage with obscene
memory allocation code that reuses statically allocated memory, but
don’t do that.
-:sigma.SBOn Jan 6, 2008 12:48 AM, Ryan C. Gordon wrote:

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 :wink:

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.

That lets you not keep all your data in
static memory (after all, that .ogg is wasted RAM once you decode it),

i never really thoguth about this like this, but i guess as long as all
my data
isnt consuming much more than about 20 ish meg then i wont worry about it too
much, but then i should worry about it if i want it to be nice on low
powered (
low memory )machines, i guess i should set a limit on just how low
powered this
game should be able to run on.

The main reason i want all the files in the exe are a) so they cant get messed
about possibly messing up the game b) er, perhaps so linux bods can
easilly run
and pass around the game without the rigmarole of $HOME and all that jazz of
where the data is and who owns it and what not.
Basically i just want it to be simple to download and use for everything it is
compiled for, apart from issues about where SDL runtime libraries are, just
simple. if that makes sence.

When i compile something for RISC OS everything SDL like goes into the final
binary anyway… there is no sdl.dll or whatever… i’m still not sure where the
various licences for sdl stand on this…

current rate of development the game might be at commercially viable
level and i
might be happy with it by about 2017 :wink: i refuse to just say b*llocks
to it and
release it as GPL and forget about it…