Jump to content
  • Advertisement
Sign in to follow this  
Stefan Fischlschweiger

XAudio2 - Problem with loops

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

So I've added some sound to my game. Single sounds play like they should, but loops give me headaches.

No matter what I try, they just won't stop playing.

 

Neither SourceVoice.Stop() nor SourceVoice.ExitLoop() or SourceVoice.FlushSourceBuffers() will stop the loop from playing, which is kind of annoying when the menu theme keeps playing on the gameplay screen.

 

Any ideas on that?

Share this post


Link to post
Share on other sites
Advertisement

Hey can you not set it to play once in the XAUDIO2_BUFFER structure;

LoopCount

 

Number of times to loop through the loop region. This value can be between 0 and XAUDIO2_MAX_LOOP_COUNT. If LoopCount is zero no looping is performed and LoopBegin and LoopLength must be 0. To loop forever, set LoopCount to XAUDIO2_LOOP_INFINITE.

Maybe set it to 1.

 

or IXAudio2MasteringVoice::DestroyVoice method may do it.

 

You need to read this Stop(0);//with 0

Edited by ankhd

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!