[directmusic] DirectMusic Unbearably Slow

  • From: bryanc@xxxxxxxxxxxxxxx
  • To: directmusic@xxxxxxxxxxxxx
  • Date: Tue, 11 May 2004 03:00:19 GMT

Hello, everyone! I've browsed the archives, and this looks to be a spot where 
all the professionals go; I'm excited to be here and hope to tap into that 
knowledge and contribute whatever I can to the discussions.

I've just added sound to my engine, and things are horribly slow on machines 
that use only motherboard sound devices. The framerate typically dips to 1/3 
or even 1/4 of what it is when no sounds are played. 

My current setup is using the DirectMusic model in the Sound Effects chapter 
of DirectX Audio Exposed (an excellent book on DirectX Audio!); however, I 
removed the culling for when hardware channels run out, since anything 
allocated after that should automatically be assigned to a software buffer. 
(To those not familiar with the book, I assign an audiopath to each sound that 
exists in space; one segment state is assigned per audiopath and represents 
the currently playing instance of the segment being played there.) Also, I get 
the framerate dips using even a handful of 3D sounds.

I've already tried some things to try and improve things, but to no avail:
1.) The primary buffer is already the same format as the sounds loaded 
(44100/16bit), and apparently setting this just to make sure won't actually do 
anything under WMD drivers anyway(which I'm guessing are the most common 
nowadays; can someone verify??).

2.) I created a custom audiopath config in DMP that used the "No 
virtualization" 3D algorithm, and created my audiopaths from that config. The 
framerate was surprisingly not improved.

3.) My sound guy lowered the frequencies on some sounds, but he reported the 
same problems (actually, he gets a framerate drop even on his SBLive, I 
believe it is).

I have a few ideas of where to poke at to significantly improve my framerate, 
but any advice or pointers anyone can offer would be great:

-Play sounds that have no randomization (or other need to be a segment) 
directly through DirectSound, bypassing DirectMusic.

-Use DuplicateBuffer to share memory of buffers using the same segments (we're 
not using any FX on them right now, only 3D positioning and volume).

-Significantly reduce the number of sounds played in 3D. I noticed Far Cry 
uses very few 3D sounds; really all ambient things are merely stereo (3D is 
used for voices of people and gunshots, and that's about it). I've seen places 
recommend minimizing your number of 3D sounds/buffers; does anyone have a 
ballpark estimate of just how cpu-intensive they are (i.e. a good max number 
to have, mostly in reference to software buffers)?

Any ideas as to which of the above would be the main place of improvement? 
Anything else I'm overlooking is obviously welcome,
too.



Other related posts: