[aquaria] Aquaria port for OS4 PPC

Andrew Church achurch+aquaria at achurch.org
Thu Jun 17 04:38:51 EDT 2010

>Maybe I'm wrong about the memory requirements. To be sure, we're using 
>way more memory than the original FMOD version of the game, since we 
>fully decode all the .ogg files upfront instead of streaming them (well, 
>upfront as we need them, it doesn't decode all the audio in the game at 

If it's feasible to use SDL threads on arbitrary platforms, you could
probably start up a decode thread for each sound played and pull PCM
data from that.  (Assuming OpenAL has a way to retrieve audio from a
function instead of a fixed buffer, that is.  In the worst case, you
could always set up a PCM ringbuffer for OpenAL and push the PCM into
there instead.)

This is the approach I take with the PSP, albeit with MP3 instead of
Ogg to take advantage of hardware support, and I haven't noticed any
sound delays while playing.

>This is worth fixing, both to reduce memory usage, and also to avoid the 
>brief hitch you experience when a new piece of dialog is about to 
>play...but I don't know that it will be a significant reduction in 
>memory use. I just haven't profiled memory allocations at all.

I did a Valgrind pass on Linux, and the decoded audio was by far the
largest memory user, at about 187MB when I closed the window.

For reference, the next one down is the Game class, which uses
2*(2222*2222*sizeof(smallInt)) for the grid[] and baseGrid[] arrays.
smallInt is typedef'd to __int8_t on Windows (and I made it uint8_t for
PSP -- belatedly, I wonder if that needs to be signed), but defaults to
a full int on other platforms, resulting in a 39MB structure.  Is there
any reason it can't default to [signed/unsigned] char instead?

  --Andrew Church
    achurch at achurch.org

More information about the aquaria mailing list