wwwxwww

How in XNA Studio it is possible to play back a sound track in game in a mode of a cycle I have a sound track on a floor of minute and I wish to play back it in current of all game how it can be made

Re: XNA Game Studio Express Playback of a sound in a mode of a cycle...

Joel Martinez

I think you're asking how to loop a sound (like, say background music) right as far as I know, there's no built in feature to do this, so you'll have to resort to looping it yourself. I don't have code in front of me so some pseudocode (or rather, head compiled) will have to do:

Cue musicCue;
..
//in your update method
if (musicCue == null || !musicCue.IsPlaying)
{
if (musicCue != null)
{
musicCue.Dispose();
}

musicCue = soundBank.GetCue("assets/theMusic");
musicCue.Play();
}

Apologies if that doesn't compile or if I missed something, but you should be able to get the gist of the code. Let me know if you have any other questions.





Re: XNA Game Studio Express Playback of a sound in a mode of a cycle...

Jim Perry

Check here.




Re: XNA Game Studio Express Playback of a sound in a mode of a cycle...

Joel Martinez

oops, yeah ... I was just doing some further research and found that :-) guess you learn something everyday