Dynamically loading sounds : best practice?

Started by kinoko, December 02, 2011, 12:02:45

Previous topic - Next topic

kinoko

Sound files are loaded dynamically (=runtime) in my app.
I implemented 2 ways of doing this.

# 1    PlayOneSound
A player for a single source.
Many instances of the player.

# 2    PlayManySounds
A single static OpenAL player, that handles buffers/source inside.
With reusing buffers.

In general is there a preferred way of playing dynamically loaded sounds?

Also, in case of a single player (#2), is it possible somehow to fill up the same buffer ( AL10#alBufferData ) with different data?
AL10.alDeleteBuffers(int) seems to delete the buffer for good, just overwriting the data also fails.
(so this 2nd approach is not working as expected so far).
In other words, can I reuse bufferData / Source?



cleo

I just realized you seem to have the same question as I do (I just started a new thread with a complete program code).

Have you found a solution in the meantime? It would be highly frustrating if OpenAL could play only a limited preset sound library during runtime. Re-initiating all buffers whenever a sound is played would be ... not elegant.


Regards