Preloading sounds


25-07-2008 23:57:23

I have many audio files (hundreds) and I would like to preload them (all or at least a portion of them) in memory. However, when I create an OgreAL::Sound it also creates an audio source, and the hardware seems to limit the number of sources to a few dozen.

in plain openAL, as far as I recall, you could have an infinite number of 'buffers' and a few sources;

So, can I have many buffers in OgreAL but only a few sources?


29-07-2008 09:02:10

The last version of ogreAL handles this for you, you can have as many sounds as you like and it will automatically manage the sources for you. It doesn't create a source each time it creates a sound, it creates all the sources it can during initialisation and holds them in a list, whenever you 'play()' a sound, it requests a new source to play the sound on from the list.

So the source limitation isn't a problem, but, I think to pre-load the sounds you need to call play() then stop() so the buffers get filled.


29-07-2008 22:21:10

oh yeah, you're right :) I just looked at Sound::play() and it does do that; I've been using an old version for a while and did not notice the change when I updated.