Create a sound loop

I am using the following code to play a wav file. I want the file to play over and over until the user clicks a button. How can i do this?

Stream stream = TitleContainer.OpenStream("Audio/ape.wav"); SoundEffect effect = SoundEffect.FromStream(stream); FrameworkDispatcher.Update(); effect.Play(); 
+4
source share
1 answer

use SoundEffectInstance.IsLooped for this. and SoundEffectInstance.Stop when a button is clicked.

+2
source

Source: https://habr.com/ru/post/1341585/


All Articles