DSEnumCallback
[The feature associated with this page, DirectSound, is a legacy feature. It has been superseded by WASAPI and Audio Graphs. Media Casting have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use Media Casting instead of DirectSound, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]
The DSEnumCallback function is an application-defined callback function that enumerates the DirectSound drivers. The system calls this function in response to the application's call to the DirectSoundEnumerate or DirectSoundCaptureEnumerate function.
Syntax
BOOL CALLBACK DSEnumCallback(
LPGUID lpGuid,
LPCSTR lpcstrDescription,
LPCSTR lpcstrModule,
LPVOID lpContext
)
Parameters
- lpGuid
Address of the GUID that identifies the device being enumerated, or NULL for the primary device. This value can be passed to the DirectSoundCreate8 or DirectSoundCaptureCreate8 function to create a device object for that driver. - lpcstrDescription
Address of a null-terminated string that provides a textual description of the DirectSound device. - lpcstrModule
Address of a null-terminated string that specifies the module name of the DirectSound driver corresponding to this device. - lpContext
Address of application-defined data. This is the pointer passed to DirectSoundEnumerate or DirectSoundCaptureEnumerate as the lpContext parameter.
Return Value
Returns TRUE to continue enumerating drivers, or FALSE to stop.
Remarks
The memory pointed to by lpGuid, lpcstrDescription, and lpcstrModule is local in scope. If you want to save these values, you must allocate them in global memory. The primary device is enumerated twice, first with NULL in lpGuid and then with its GUID in that parameter.
Requirements
Header: Declared in DSound.h.