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

XAudio2 - Problem with loops

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

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



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.

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!