Platform SDK: DirectX |
DirectSound allows your application to retrieve the hardware capabilities of the sound device. Most applications will not need to do this, because DirectSound automatically takes advantage of any available hardware acceleration. However, high-performance applications can use the information to scale their sound requirements to the available hardware. For example, an application might play more sounds if hardware mixing is available than if it is not.
After calling the DirectSoundCreate function to create a DirectSound object, your application can retrieve the capabilities of the sound device by calling the IDirectSound::GetCaps method.
The following example retrieves the capabilities of the device that was initialized in Creating the DirectSound Object.
DSCAPS dscaps; dscaps.dwSize = sizeof(DSCAPS); HRESULT hr = lpDirectSound->lpVtbl->GetCaps(lpDirectSound, &dscaps);
The DSCAPS structure receives information about the performance and resources of the sound device, including the maximum resources of each type and the resources that are currently available. Note that the dwSize member of this structure must be initialized before the method is called.
If your application scales to hardware capabilities, you should call the IDirectSound::GetCaps method between every buffer allocation to determine if there are enough resources to create the next buffer.
After calling the DirectX7.DirectSoundCreate method to create a DirectSound object, your application can retrieve the capabilities of the sound device by calling the DirectSound.GetCaps method.
The following example retrieves the capabilities of the device that was initialized in Creating the DirectSound Object.
Dim DSCAPS As DSCAPS m_ds.GetCaps DSCAPS
The DSCAPS type receives information about the performance and resources of the sound device, including the maximum resources of each type and the resources that are currently available.
If your application scales to hardware capabilities, you should call the DirectSound.GetCaps method between every buffer allocation to determine if there are enough resources to create the next buffer.