SetCooperativeLevel(hwnd, level)

The IDirectSound::SetCooperativeLevel method sets the cooperative level of the application for this sound device.


hwnd : int

Window handle to the application or None.

level : int

Requested priority level. Specify one of the following values:

Level Description
DSSCL_NORMALSets the application to a fully cooperative status. Most applications should use this level, because it has the smoothest multitasking and resource-sharing behavior.
DSSCL_PRIORITYSets the application to the priority level. Applications with this cooperative level can call the DirectSoundBuffer.setFormat and DirectSound.compact methods.
DSSCL_EXCLUSIVESets the application to the exclusive level. When it has the input focus, the application will be the only one audible (sounds from applications with the DSBCAPS_GLOBALFOCUS flag set will be muted). With this level, it also has all the privileges of the DSSCL_PRIORITY level. DirectSound will restore the hardware format, as specified by the most recent call to the DirectSoundBuffer.setFormat method, once the application gains the input focus. (Note that DirectSound will always restore the wave format, no matter what priority level is set.)
DSSCL_WRITEPRIMARYThis is the highest priority level. The application has write access to the primary sound buffers. No secondary sound buffers in any application can be played.