• Advertisement
Sign in to follow this  

OpenAL - Retrieve true/false if source is playing?

This topic is 3300 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

Im using openal and im trying to play and loop a source however my call to play the source is required to be in a block of code that is frequently called so instead of making it start again and again i need to create an if statement to check to see if its already playing any ideas how?
	if(    ** source[9] isnt playing ** )
	{
		alSourcePlay(source[9]);	
	}

Also anyone know any good websites that i can get information like this from?

Share this post


Link to post
Share on other sites
Advertisement
You can query information about the source(like state information) using alGetSourcei(). The state information will tell you it the source is stopped or not.

I believe there are openal tutorials on this site or you can download docs included with the SDK here.

Share this post


Link to post
Share on other sites
I think this is the code:

bool isPlaying()
{
ALenum state;

alGetSourcei(source, AL_SOURCE_STATE, &state);

return (state == AL_PLAYING);
}

Share this post


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

  • Advertisement