[Openal] Playing a sound twice at the same time.

Chris Robinson chris.kcat at gmail.com
Mon Aug 27 08:25:46 PDT 2007


On Monday 27 August 2007 07:56:53 am Leben Ojanen wrote:
> Right now I want to be able to load a sound once, then play it more
> than once, at the same time.
>
> So far I have been unable to do this, probably due to my lack of
> understanding of how OpenAL works.
>
> At this time, I can load a sound, but trying to play it twice with my
> current implementation causes the first "playback" to just stop while
> the other starts.
>
> Could someone please point me in the right direction on how to fix this?

Sounds in OpenAL are split into two parts.. buffers (which hold the sound 
data) and sources (which are the sound "controls", so to speak). A source is 
what you use to play and stop a sound, and a buffer is where you store the 
sound.

To be able to play the same sound multiple times at the same time, you need to 
create a source for each individual playback, but attach them all to the same 
buffer. Multiple sources can use the same buffer, so playing multiple sources 
that use the same buffer will give the effect you want.


More information about the Openal mailing list