Minimizing Control Changes

Performance is affected when you change the pan, volume, or frequency on a secondary buffer. To prevent interruptions in sound output, the Microsoft DirectSound mixer must mix ahead from 20 to 100 or more milliseconds. Whenever you make a control change, the mixer has to flush its mix-ahead buffer and remix with the changed sound.

It is a good idea to minimize the number of control changes you send. Try reducing the frequency of calls to routines that use SecondaryBuffer.Volume, .Pan, and .Frequency. For example, if you have a routine that moves a sound from the left to the right speaker in synchronization with animation frames, try setting Pan only every second or third frame.

Note: 3-D control changes (orientation, position, velocity, Doppler factor, and so on) also cause DirectSound to remix its mix-ahead buffer. However, you can group a number of 3-D control changes together and cause only a single remix. See 3-D Listeners.