DirectX SDK |
The IDirectMusicPort::SetDirectSound method is used to override the default DirectSound object or buffer, or both, to which a port's wave data is streamed. It is also used to disconnect the port from DirectSound.
HRESULT SetDirectSound( LPDIRECTSOUND pDirectSound, LPDIRECTSOUNDBUFFER pDirectSoundBuffer );
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 following error values:
DMUS_E_ALREADY_ACTIVATED |
E_INVALIDARG |
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 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_PORTPARAMS structure passed to IDirectMusic::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 once the port has been activated.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dmusicc.h.
IDirectMusicPort::Activate, IDirectMusicPort::GetFormat, Integrating DirectMusic and DirectSound