Microsoft Windows CE 3.0  

Buffer Management

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 IDirectSoundBuffer::GetCapsmethod retrieves the capabilities of the DirectSoundBuffer object.

Your application can use the IDirectSoundBuffer::GetStatusmethod to determine if the current sound buffer is playing or if it has stopped.

You can use the IDirectSoundBuffer::GetFormatmethod to retrieve information about the format of the sound data in the buffer. You also can use the IDirectSoundBuffer::GetFormatand IDirectSoundBuffer::SetFormatmethods 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_BUFFERLOSTerror code is returned when the IDirectSoundBuffer::Lockor IDirectSoundBuffer::Playmethod 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::Restoremethod. 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 Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.