Jump to content
  • Advertisement
Sign in to follow this  
knobby67

opanAL detect end of sample

This topic is 3502 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi all, I've just moved over to openAL from sdl mixer. All is fine except in my code I wait for a sample to stop, in sdl mixer I use a while(Mix_Playing(sound_channel)); which wait for a channel to stop. However I can't seem to find a way for openAL to detect the end of a sound, can anyone help? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
I believe this should accomplish what you want:


ALuint state;
alGetSourcei(source, AL_SOURCE_STATE, &state);
while(val == AL_PLAYING);




Note however that
while(val == AL_PLAYING);
is bad practice as it'll use up all of the cpu power available for the program, it doesn't look very good either.

Share this post


Link to post
Share on other sites
Quote:
Original post by HomerSp
I believe this should accomplish what you want:

*** Source Snippet Removed ***

Note however that
while(val == AL_PLAYING);
is bad practice as it'll use up all of the cpu power available for the program, it doesn't look very good either.


Ummm... shouldn't that be:

while(state == AL_PLAYING);

instead?

Share this post


Link to post
Share on other sites
Quote:
Original post by samuraicrow
Quote:
Original post by HomerSp
I believe this should accomplish what you want:

*** Source Snippet Removed ***

Note however that
while(val == AL_PLAYING);
is bad practice as it'll use up all of the cpu power available for the program, it doesn't look very good either.


Ummm... shouldn't that be:

while(state == AL_PLAYING);

instead?

Of course, sorry. I was a bit distracted when I wrote that reply :P

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!