Hello, i have written a little sound system for my very little 3D engine, and when i create a lots of sounds, at some point my app freeze during a fraction of second.

this only happens when i use DirectSound, not with waveOut (so with software mixing).

so for exemple my engine works at 300/400fps (just some outer planets laying around), the sound system is regulated at 30 ticks/secs (ie the sounds are updated every 10 frames, by a dynamic regulation).

i have a routine that copy a 3D object, and “plays a sound”.
this routine is called when i press a key, so i have a copy rate of 30 new objects/secs (due to the keyboard typematic setting), so the same for the sound playing.

the “plays a sound” implementation is a ‘new engine sound objet’ is attached the to new 3D object, and the ‘new engine sound object’ is processed by the sound system (at 30 ticks/secs), which commits the play to fmod (so the next incoming tick).

When the sound has been totally played (FSOUND_IsPlaying returns that the sound is not being playing anymore) the fmod channel will be freed and the ‘engine sound objet’ deleted on some following sound system tick.

my sound card is an audigy with the latest drivers, so i would like to know if there any things i should be aware when using hardware mixing :??:

  • You must to post comments

Huhu, my mystake….

by writting the post, i was investigating my code, i’ve found that when i copy a 3D object, it was duplicating its sounds collection, which caused the problem. after i disabled the sound collection duplication, there were no freezes.
i suppose it was the copy without clearing the sound status (from my sound system pov).
a playing sound copied is not a really a playing sound 😀

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.