Handmade Hero»Forums»Code
Matt Hartley
19 posts
I like to program the things.
DirectSound mixer low frame rate issues
I've implemented a custom mixer using direct sound in the game I'm working on.
At 60fps it runs perfectly but at slower frame rates it occasionally stutters and produces audible glitches.
I'm pretty sure the mixer is mixing in samples correctly as it works at 60fps and I've also done loads of assertions to make sure no samples are missed out or played twice. I also tried mixing in a minutes worth of audio and then leaving it alone and it's still stutters which makes me think it's something to do with direct sounds playback. I'm initialising direct sound the same way Casey does, are there additional setup options that may help?

Does anyone know what the problem could be?

Thanks
--Matt
Ginger Bill
222 posts / 2 projects
I am ginger thus have no soul.
DirectSound mixer low frame rate issues
When are you updating the audio? It looks like you are linking you updates rate with your render rate. These things should not be linked for numerous reason like the one you have seen/heard. This however may not be the problem but if it is, try fixing the update rate but not the render rate.
Matt Hartley
19 posts
I like to program the things.
DirectSound mixer low frame rate issues
I am updating the audio with the render rate yes, but in my mixer I'm writing a second in front of the write cursor and then each frame filling out the little bit to have a second in front of the write cursor again so it should be able to handle any frame rate.
Matt Hartley
19 posts
I like to program the things.
DirectSound mixer low frame rate issues
I'll give your suggestion a try when I home though, maybe my assumptions about what's happening in my mixer are wrong.
Thanks for your help!