Setting the DirectSound Buffer Object

When DirectMusic is linked to DirectSound, it creates and manages a secondary DirectSound buffer for the wave output from each port, in a format matching that of the port. You can override the default behavior and ensure that the data is streamed to a different buffer, by using the IDirectMusicPort::SetDirectSound method. You can do this, for example, to have 3-D effects on the sound buffer. (See the the 3DMusic Sample.) You might even create multiple instances of the synthesizer port, each with its own DirectSound 3-D buffer, to place different instruments at different points in space.

The buffer you pass to IDirectMusicPort::SetDirectSound must be a secondary streaming buffer with a matching format. You can get information about the wave format and recommended buffer size by calling the IDirectMusicPort::GetFormat method.

DirectMusic will not attempt to upgrade the primary buffer when you pass your own IDirectSoundBuffer to IDirectMusicPort::SetDirectSound.