.ogg sound effects in SDL_Mixer

I am attempting to reduce the size of my project as much as possible,
and am wondering if it would be possible to store sound effects as
.ogg’s, and decompress them into Mix_Chunks in memory, rather than using
them as streams.

I am attempting to reduce the size of my project as much as possible,
and am wondering if it would be possible to store sound effects as
.ogg’s, and decompress them into Mix_Chunks in memory, rather than using
them as streams.

SDL_mixer can decompress .ogg files. Be aware that SDL_mixer currently
uncompresses the entire sample before playback, so while your disk
footprint will reduce if you use Ogg Vorbis (or MP3, etc), the
uncompressed waveform is stored in whole in memory until you delete the
chunk.

(This behaviour will change, so that a file can optionally be streamed
from disk or wherever as needed instead of being read as a
whole…sometime in the future.)

–ryan.

“Ryan C. Gordon” wrote:

I am attempting to reduce the size of my project as much as possible,
and am wondering if it would be possible to store sound effects as
.ogg’s, and decompress them into Mix_Chunks in memory, rather than using
them as streams.

SDL_mixer can decompress .ogg files. Be aware that SDL_mixer currently
uncompresses the entire sample before playback, so while your disk
footprint will reduce if you use Ogg Vorbis (or MP3, etc), the
uncompressed waveform is stored in whole in memory until you delete the
chunk.

–ryan.

That’s exactly what I wanted; to have them compressed on disk but uncompressed
in mem. I see no way to do what you describe in SDL_Mixer, however; I see no
way to load a .ogg into a Mix_Chunk and play it like an ordinary wave file.
All I see are routines for music and streaming.

That’s exactly what I wanted; to have them compressed on disk but uncompressed
in mem. I see no way to do what you describe in SDL_Mixer, however; I see no
way to load a .ogg into a Mix_Chunk and play it like an ordinary wave file.
All I see are routines for music and streaming.

Oh, I see. Sorry.

Yeah, you can play .OGGs in SDL_mixer, but only one at a time, since
they’re considered “music” channels. This will also be changing, once
SDL_sound (which currently handles OGGs) is complete and generally
portable, and becomes the backend for SDL_mixer.

–ryan.

Why don’t you hack something like a SID emulator, and generate the sounds
algorithmically, in real time? :slight_smile:

Another similar alternative would be generating sounds algorithmically
when the game starts up, and store them as raw waveforms in memory for
playback - but that way, you lose the flexibility that a real time synth
engine provides.

//David Olofson — Programmer, Reologica Instruments AB

.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------------> http://www.linuxdj.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |--------------------------------------> david at linuxdj.com -'On Monday 24 September 2001 04:38, Tyler Montbriand wrote:

I am attempting to reduce the size of my project as much as possible,
and am wondering if it would be possible to store sound effects as
.ogg’s, and decompress them into Mix_Chunks in memory, rather than
using them as streams.