Retrieves a pointer to a DirectSound object interface.

void *BASS_GetDSoundObject(
    DWORD object


objectThe interface to retrieve. This can be a HCHANNEL, HMUSIC or HSTREAM handle, in which case an IDirectSoundBuffer interface is returned, or one of the following.
BASS_OBJECT_DSRetrieve the IDirectSound interface.
BASS_OBJECT_DS3DLRetrieve the IDirectSound3DListener interface.

Return value

If successful, then a pointer to the requested object is returned, otherwise NULL is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_INITBASS_Init has not been successfully called.
BASS_ERROR_ILLPARAMobject is invalid.
BASS_ERROR_NOTAVAILThe requested object is not available with the current device.


This function allows those that are familiar with DirectSound to access the internal DirectSound object interfaces, so that extra external functionality can be "plugged" into BASS. If you create any objects through a retrieved interface, make sure you release the objects before calling BASS_Free.

See the DirectX SDK for information on the DirectSound interfaces.

When using multiple devices, and requesting either the BASS_OBJECT_DS or BASS_OBJECT_DS3DL object interfaces, the current thread's device setting (as set with BASS_SetDevice) determines which device this function call applies to.


DirectSound in a Windows thing, so this function is not available on other platforms.


Set the speaker configuration to "headphones".
#include <dsound.h>
IDirectSound *ds = BASS_GetDSoundObject(BASS_OBJECT_DS); // get object
IDirectSound_SetSpeakerConfig(ds, DSSPEAKER_HEADPHONE); // headphones

See also