Microsoft Windows CE 3.0  

Creating the DirectSound Object

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The simplest way to create the DirectSound object is with the DirectSoundCreatefunction. The first parameter of this function specifies the GUID of the device to be associated with the object. You can obtain this GUID by Enumeration of Sound Devices, or you can simply pass NULL to create the object for the default device.

LPDIRECTSOUND lpds; HRESULT hr =
DirectSoundCreate(NULL, &lpds, NULL));

The function returns an error if there is no sound device or if the sound device is under the control of an application using the waveform-audio (non-DirectSound) functions. You should prepare your applications for this call to fail so that they can either continue without sound or prompt the user to close the application that is already using the sound device.



 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.