Microsoft DirectX 9.0

Property Sets for DirectSound Buffers

To make use of extended properties on sound cards, you must first determine whether the driver supports the IKsPropertySet interface, and obtain a pointer to the interface if it is supported. You can do this by calling the QueryInterface method of an existing interface on a DirectSound 3-D buffer object, as follows:

HRESULT hr = lpDirectSound3DBuffer->QueryInterface(

In the example, lpDirectSound3DBuffer is a pointer to the buffer's interface and lpKsPropertySet receives the address of the IKsPropertySet interface if one is found. IID_IKsPropertySet is a GUID defined in Dsound.h. The interface is available only if the buffer is hardware-accelerated and the underlying driver supports property sets.

Note   The declaration of this interface in Dsound.h is different from that in Ksproxy.h and Strmif.h. If your project includes Ksproxy.h or Strmif.h but you wish to use the DirectSound implementation, be sure to include Dsound.h first. Failing to do so may cause your application to stop responding when a method of IKsPropertySet is called.

You can look for a particular property by using the IKsPropertySet::QuerySupport method. The value of the PropertySetId parameter is a GUID defined by the hardware vendor.

After you've determined that support for a particular property exists, you can change the state of the property by using the IKsPropertySet::Set method and determine its present state by using the IKsPropertySet::Get method. The state of the property is set or returned in the pPropertyData parameter.

Additional property parameters may also be passed to the object in the pPropertyParams parameter to the IKsPropertySet::Set method. The exact way in which this parameter is to be used is defined in the hardware vendor's specifications for the property set, but typically it would be used to define the instance of the property set. In practice, the pPropertyParams parameter is rarely used.