Platform SDK: DirectX

DirectSoundBuffer.Restore

The DirectSoundBuffer.Restore method restores the memory allocation for a lost sound buffer.

object.Restore()

Parameters

object
Object expression that resolves to a DirectSoundBuffer object.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following error codes.

DSERR_BUFFERLOST
DSERR_INVALIDCALL
DSERR_PRIOLEVELNEEDED

Remarks

If the application does not have the input focus, DirectSoundBuffer.Restore might not succeed. For example, if the application with the input focus has the DSSCL_WRITEPRIMARY cooperative level, no other application will be able to restore its buffers.

Once DirectSound restores the buffer memory, the application must rewrite the buffer with valid sound data. DirectSound cannot restore the contents of the memory, only the memory itself.

The application can receive notification that a buffer is lost when it specifies that buffer in a call to the DirectSoundBuffer.WriteBuffer or DirectSoundBuffer.Play method. These methods return DSERR_BUFFERLOST to indicate a lost buffer. The DirectSoundBuffer.GetStatus method can also be used to retrieve the status of the sound buffer and test for the DSBSTATUS_BUFFERLOST flag.

See Also

DirectSoundBuffer.GetStatus