Jump to content


OpenAL can't replay sounds


2 replies to this topic

#1 Zeussy

    New Member

  • Members
  • Pip
  • 3 posts

Posted 14 February 2006 - 04:41 AM

So, I've been busy, modifiy the tutorials around to make a OpenAL wrapper class.

I've been writing a renderer in Directx and linking objects to sources so I can update there position and stuff, but that isnt so much the problem.

I can't replay a sound once its been played, here is my little function:


void zSoundEngine::PlaySound( int Source )

{

	//Check if sound is playing	

	int play;

    alGetSourcei(g_Sources[Source], AL_SOURCE_STATE, &play);


    if (play != AL_PLAYING)

	{

		// Play

		alSourcePlay(g_Sources[Source]);

		if ((error = alGetError()) != AL_NO_ERROR)

			DisplayALError("alSourcePlay : ", error);	


	}

}


Now, it plays the sound once, then never again. But if I step through, it will repeat the sound. But only if I step through alSourcePlay.

Another thing I have noticed, i downloaded the Multiple sources Tut, and just ran the ExE, none of the sources replay in that, appart from the looping battlefield sound.

So I'm completely stumped, almost seems like a dodgy dll to me, but idk.

Any help will be appreciated.

#2 lazarus

    New Member

  • Members
  • Pip
  • 1 posts

Posted 26 July 2006 - 01:36 PM

Call alSourceRewind(g_Sources[Source]) before alSourcePlay(...)

#3 monjardin

    Senior Member

  • Members
  • PipPipPipPip
  • 1033 posts

Posted 26 July 2006 - 02:53 PM

Lazarus: What an appropriate name for a forum necromancer!
monjardin's JwN Meter (1,2,3,4,5,6):
|----|----|----|----|----|----|----|----|----|----|
*





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users