Platform SDK: DirectX

Setting the DirectSound Buffer Object

[Visual Basic]

This topic pertains only to applications written in C++. DirectX for Visual Basic does not support custom DirectSound buffers for DirectMusic output.

[C++]

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 might do this, for example, to have 3-D effects on the sound buffer. (See 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 that you pass to IDirectMusicPort::SetDirectSound must be a secondary streaming buffer with a matching format. Get information about the wave format and recommended buffer size by calling the IDirectMusicPort::GetFormat method.

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