Buffer.Restore Method

Language:

Restores the memory allocation for a lost sound buffer.

Definition

Visual Basic Public Sub Restore()
C# public void Restore();
C++ public:
void Restore();
JScript public function Restore();

Remarks

If the application does not have the input focus, Buffer.Restore might not succeed. For example, if the application with the input focus has the CooperativeLevel.WritePrimary cooperative level, no other application will be able to restore its buffers. Similarly, an application with the CooperativeLevel.WritePrimary cooperative level must have the input focus to restore its primary sound buffer.

After Microsoft DirectSound restores the buffer memory, the application must rewrite the buffer with valid sound data. DirectSound can only restore the memory itself, not the contents of the memory.

The application can receive notification that a buffer is lost when the following methods are called:

These methods throw BufferLostException to indicate a lost buffer. The Buffer.Status property can also be used to retrieve the status of the sound buffer and test the BufferStatus.BufferLost property.

Exceptions
BufferLostException The buffer memory has been lost and must be restored.
InvalidCallException The method call is invalid for the current state of this object.
PriorityLevelNeededException A cooperative level of Priority or higher is required.

Applies To

SecondaryBuffer

Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center