I used soundeffect instance to play the background music. But I'm not able to stop the sound. I used Common class to play and stop sounds.
Is there anyway to stop music while playing using soundeffectinstance?
I used soundeffect instance to play the background music. But I'm not able to stop the sound. I used Common class to play and stop sounds.
Is there anyway to stop music while playing using soundeffectinstance?
SoundEffect
is fire-and forget:
Sounds play in a "fire and forget" fashion with Play; therefore, the lifetime of these sounds is managed by the framework. These sounds will play once, and then stop. They cannot be looped or 3D positioned. To loop a sound or apply 3D effects, call CreateInstance instead of Play, or call SoundEffectInstance.Play.
You need to create a SoundEffectInstance
instead, then you can use SoundEffectInstance.Stop() ?