Microsoft DirectX 8.1 (Visual Basic)

DirectSoundSecondaryBuffer8.Restore

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

Syntax

object.Restore()

Parts

object

Resolves to a DirectSoundSecondaryBuffer8 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, DirectSoundSecondaryBuffer8.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 DirectSoundSecondaryBuffer8.WriteBuffer or DirectSoundSecondaryBuffer8.Play method. These methods return DSERR_BUFFERLOST to indicate a lost buffer. The DirectSoundSecondaryBuffer8.GetStatus method can also be used to retrieve the status of the sound buffer and test for the DSBSTATUS_BUFFERLOST flag.

See Also