Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In my code I'm using SoundBank.GetCue("cuename") and Cue.Play() to play my sounds.

On the xbox whenever I first play a cue I get lag of about about one second.
How can I avoid this?

I'm thinking I probably have to do something like call GetCue (without playing it) for every Cue I'm going to use, however I don't have a central place where I list all cues I'll want to play, so is there an easy way to do that?


Update: It seems calling GetCue for all sounds i want to play doesn't work. I'm still getting stuttering in various places in my game when i call GetCue....Play.

share|improve this question
    
Are you already using compressed audio formats (WAV instead of MP3)? –  George Clingerman Feb 5 '12 at 16:22
    
Also make sure that your SoundBank type is set to InMemory instead of Streaming. That was some advice I found here -> forums.create.msdn.com/forums/p/2677/13360.aspx#1336000 –  George Clingerman Feb 5 '12 at 16:30
    
I'm using WAV files, I had it as InMemory, I've also tried Streaming which did actually help a bit, i just have a slight delay the first time i play something, but the whole game doesn't stop. –  George Duckett Feb 5 '12 at 20:03
add comment

1 Answer 1

up vote 2 down vote accepted

I've tried introspecting the SoundBank class hoping to find some way to know which cues are stored in it, but found no way to enumerate over all cues other than by name. The class is pretty much just a wrapper that delegates all method calls to the lower level XACT3 engine.

So I'll have to suggest that you go with your current train of thought, by creating your own list of cues, for example in a txt file, and doing a preload step in your game where you enumerate over all names in the list and call GetCue for each of them.

share|improve this answer
    
Thanks, that has helped, but still when I play sound sometimes it stutters. Its as if it only keeps one or 2 cues in memory, then stutters if I get it to play one it doesn't have. –  George Duckett Feb 4 '12 at 18:51
    
@GeorgeDuckett I've never used the SoundBank class before so I'm not sure... But maybe it's related to the remark in this link. In particular the the Cue is marked to be disposed by the garbage collector part. –  David Gouveia Feb 4 '12 at 19:16
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.