[Openal-devel] Problem playing different sound using same source id
MaciejS
msawitus at gmail.com
Mon Feb 2 15:38:44 PST 2009
Hi,
I've just hit weird problem with OpenAL when trying to play sound using
source which was previously used for playing different sound.
I have installed latest OpenAL and got latest OpenAL SDK (1.1).
The exact repro scenario is as follows:
(1) initialize openal, allocate as many as possible source ids
(2) grab first source id and play the sound A, wait till it finishes
(3) use the same source id and play sound B <<== the sound doesn't play even
though openal sais it being plays
I can repeat (3) as many times as I want and the sound will never actually
be heard. If I use another source id from allocated pool, then it plays.
Sound A can be played again as many times as I want using first source id
though.
However if I play any sound while sound B is still supposed to play (and so,
I need to use another source id), the sound B gets _unlocked_ and it can
suddenly be heard from where it was supposed to be at that time. From now on
I can play B as many times as I want.
I have double checked I don't change _any_ source attributes like pitch /
gain or other.
This is the complete OpenAL calls that lead to problem:
source0 is my source id
bufferA and bufferB are two OpenAL sound buffers
// Play sound A
alSourcei(source0, AL_BUFFER, bufferA);
alSourcePlay(source0);
while (true)
{
ALint state;
alGetSourcei(source0, AL_SOURCE_STATE, &state);
if (state == AL_STOPPED)
break;
}
alSourceStop(source0);
alSourcei(source0, AL_BUFFER, 0);
// Play sound B - won't play !!!!
alSourcei(source0, AL_BUFFER, bufferB);
alSourcePlay(source0);
while (true)
{
ALint state;
alGetSourcei(source0, AL_SOURCE_STATE, &state);
if (state == AL_STOPPED)
break;
}
alSourceStop(source0);
alSourcei(source0, AL_BUFFER, 0);
Thanks anyone for any help with that!
--
View this message in context: http://www.nabble.com/Problem-playing-different-sound-using-same-source-id-tp21617947p21617947.html
Sent from the OpenAL - Dev mailing list archive at Nabble.com.
More information about the Openal-devel
mailing list