WP7 XNA Game 'stutters' when music repeats

At the beginning of a level in my XNA based game, I'm using MediaPlayer.Play() to play a .mp3 file and MediaPlayer.Repeating set to true to repeat the music.

When the music repeats, there is a considerable stutter in the game that is very annoying - the game essentially pauses, like it's waiting for the phone to find and play the music and then continues.

I tried to prevent this by setting MediaPlayer.Repeating to false and then just restarting the music manually (by detecting when it finished) and the stutter was still there.

Does anybody have any idea why this is happening/ know how to fix it?

Edit: This issue only occurs on the phone, not the emulator.


Well, I recommend having the sound managed in another thread so it wouldn't interfere with the actual gameplay. Parallel Threading?

Also check how you are loading the music also. It might also be how you manage your music too.

Try debugging your method that repeats the music when you have it on your phone by setting break points to see what it does or even try going to Debug -> Start Windows Phone Performance Analysis and see what threads are active when the music repeats.

That's my two cents from a fellow 16 year old programmer :D

链接地址: http://www.djcxy.com/p/22768.html

上一篇: XNA for WP7游戏:DrawUserIndexedPrimitives

下一篇: 当音乐重复时,WP7 XNA Game'口吃'