The IDirectSoundBuffer::GetCaps method retrieves the capabilities of the DirectSoundBuffer object.
Your application can use the IDirectSoundBuffer::GetStatus method to determine if the current sound buffer is playing or if it has stopped.
You can use the IDirectSoundBuffer::GetFormat method to retrieve information about the format of the sound data in the buffer. You also can use the IDirectSoundBuffer::GetFormat and IDirectSoundBuffer::SetFormat methods to retrieve and set the format of the sound data in the primary sound buffer.
Note After a secondary sound buffer is created, its format is fixed. If you need a secondary buffer that uses another format, you must create a new sound buffer with this format.
Memory for a sound buffer can be lost in certain situations: for example, when buffers are located in sound card memory and another application gains control of the hardware resources. Loss can also occur when an application with the write-primary cooperative level moves to the foreground; in this case, DirectSound makes all other sound buffers lost so that the foreground application can write directly to the primary buffer.
The DSERR_BUFFERLOST error code is returned when the IDirectSoundBuffer::Lock or IDirectSoundBuffer::Play method is called for a lost buffer. When the application that caused the loss either lowers its cooperative level from write-primary or moves to the background, other applications can attempt to reallocate the buffer memory by calling the IDirectSoundBuffer::Restore method. If successful, this method restores the buffer memory and all other settings for the buffer, such as volume and pan settings. However, a restored buffer may not contain valid sound data, so the owning application should rewrite the data to the buffer.
Last updated on Thursday, April 08, 2004
© 1992-2003 Microsoft Corporation. All rights reserved.