|Microsoft DirectX 9.0|
The SetDirectSound method overrides the default DirectSound device object or buffer, or both, to which a port's waveform data is streamed. This method is also used to disconnect the port from DirectSound.
HRESULT SetDirectSound( LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer );
Address of the IDirectSound8 interface of the DirectSound device object to which the port is to be connected, or NULL to disconnect and release the existing DirectSound device object.
Address of the IDirectSoundBuffer8 interface to connect the port to. This value can be NULL, and must be NULL if pDirectSound is NULL. This parameter is not used if the port is the Microsoft software synthesizer in DirectX 8.0 or later.
If the method succeeds, the return value is S_OK or DMUS_S_NOBUFFERCONTROL. See Remarks.
If it fails, the method can return one of the error values shown in the following table.
If a valid pointer is passed in pDirectSoundBuffer, the method returns DMUS_S_NOBUFFERCONTROL if control changes in the buffer such as pan and volume do not affect DirectMusic playback. This affects only Windows Driver Model (WDM) ports.
When the port is activated, the primary DirectSound buffer is upgraded, if necessary, to support the sample rate and channel information for this port (specified in the DMUS_PORTPARAMS8 structure passed to IDirectMusic8::CreatePort).
The buffer pointed to by pDirectSoundBuffer must be a secondary streaming buffer with a format that matches the sample rate and channel information for this port. If this parameter is NULL, an appropriate IDirectSoundBuffer instance is created internally.
Neither the IDirectSound nor the IDirectSoundBuffer can be changed after the port has been activated.
Header: Declared in dmusicc.h.