dagfari

After about 10-15 minutes of gameplay, the audio slowly begins to become more and more distorted and fractured sounding. Both the sound FX and BGM gradually become more choppy and grainy sounding while dragging down the overall performance of the game. Any ideas



Re: XNA Game Studio Express General Audio Disfunction

Jim Perry

Badly written code




Re: XNA Game Studio Express General Audio Disfunction

Jack H. Palevich

It sounds like you need to call AudioEngine.Update in your game's Update method. (I made the same mistake, and got the same results.)





Re: XNA Game Studio Express General Audio Disfunction

dagfari

I do call audioengine.update in the update method. Audio works perfectly fine for a while. What coding issue would cause audio problems to occur over a period of time






Re: XNA Game Studio Express General Audio Disfunction

Fluxtah

might be an idea to post your code that deals with the playing of audio, XNA is very new so its highly likely no one has experienced the problems you describe.





Re: XNA Game Studio Express General Audio Disfunction

dagfari

my code for audio is pretty straight forward. My general routine for calling sound FX is;

1) call 'cue stop' in case the effect is still playing

2) call 'get cue' to retrieve the sound again

3) call play

I do this in most cases where I only want one instance of the effect occuring at a time and there is a chance the sound will not have finished playing before it needs to be played again like in the case of a rapid fire weapon.






Re: XNA Game Studio Express General Audio Disfunction

Bill Reiss

I had this problem once, and when I called the Play method that doesn't require a previous GetCue() it worked fine.

Bill






Re: XNA Game Studio Express General Audio Disfunction

dagfari

What play method doesn't require GetCue

Oh PlayCue(); right    I'll try that.  Thanks.





Re: XNA Game Studio Express General Audio Disfunction

Jack H. Palevich

Sorry the Update trick didn't help. It still sounds like an XACT starvation / over-work issue. I guess I would do the following things if I were you:

1) When the bug happens, break into the debugger and check what your code is doing. It's possible that your game is starving XACT by doing a lot of computation on other threads.

2) Try to verify that your audio engine's Update method is actually being called frequently. Maybe add a counter and print out a debug message every 60 times that Update is called, or something like that.

3) When the problem happens, use the "Task Manager" to see what your CPU usage is. If the problem is related to XACT having too much work to do, then you'll typically see a high CPU usage (one hardware thread maxed out.) If you don't see a high CPU usage, then it's possible that you've got some other problem.

4) See if you can cause the problem to repro sooner by giving XACT more work to do -- change your game code to fire off 10 sound effects each time, rather than just one.

5) Create a repro case you can file a bug report for. If you want the bug fixed, the easiest way to get the XNA team to help you is to have an automatic, or nearly automatic repro case. When I had a similar problem, I added an event recording and playback system to my game, so that I could record 10 minutes of gameplay manually, and then automatically repro it.

Once you have your repro case, either pack it into a 2 MB ZIP file (the max size for a Connect bug report), or figure out how to post it on a web site some where. Then follow the bug reporting instructions on the "Frequently Asked Questions" portion of the XNA Game Studio Express online docs.





Re: XNA Game Studio Express General Audio Disfunction

dagfari

Yeah, I'll try to narrow down on it. By the way, this is all happening on Xbox360.





Re: XNA Game Studio Express General Audio Disfunction

Mu0n

Any update on your problem

I've fiddled with XACT for the first time these last days, and I'm having a similar issue (windows only, since I have no xbox360). The distortion happens right away. I am using a rather large wav file (around 20 megs - as a side note, it is a playback recording of a 50k MOD file, heh).

As soon as I put comments on audioengine.update() 's method in the game's update method, the problem goes away and the playback is smooth.






Re: XNA Game Studio Express General Audio Disfunction

dagfari

It seems to be working ok for me but it's hard to test. I did simplify things a bit by not making every sound a Cue object. I only make Cue objects when I need control over the sound such as stopping it in the middle of playback. Otherwise I simply use PlayCue.





Re: XNA Game Studio Express General Audio Disfunction

Pange

I had a similar problem when using cue objects. It seems it's a garbage collection issue - the cue object gets garbage collected while the cue is still playing - so the sound stops at random points. PlayCue() doesn't have these problems.