Microsoft DirectX 9.0

IDirectSoundBuffer8::Unlock

The Unlock method releases a locked sound buffer.

Syntax

HRESULT Unlock(
  LPVOID pvAudioPtr1, 
  DWORD dwAudioBytes1, 
  LPVOID pvAudioPtr2, 
  DWORD dwAudioBytes2 
);

Parameters

pvAudioPtr1

Address of the value retrieved in the ppvAudioPtr1 parameter of the IDirectSoundBuffer8::Lock method.

dwAudioBytes1

Number of bytes written to the portion of the buffer at pvAudioPtr1. See Remarks.

pvAudioPtr2

Address of the value retrieved in the ppvAudioPtr2 parameter of the IDirectSoundBuffer8::Lock method.

dwAudioBytes2

Number of bytes written to the portion of the buffer at pvAudioPtr2. See Remarks.

Return Values

If the method succeeds, the return value is DS_OK.

If the method fails, the return value may be one of the following error values:

Return code
DSERR_INVALIDCALL
DSERR_INVALIDPARAM
DSERR_PRIOLEVELNEEDED

Remarks

An application must pass both pointers, pvAudioPtr1 and pvAudioPtr2, returned by the IDirectSoundBuffer8::Lock method to ensure the correct pairing of IDirectSoundBuffer8::Lock and IDirectSoundBuffer8::Unlock. The second pointer is needed even if nothing was written to the second pointer.

The values in dwAudioBytes1 and dwAudioBytes2 must specify the number of bytes actually written to each part of the buffer, which might be less than the size of the lock. DirectSound uses these values to determine how much data to commit to the device.

Requirements

  Header: Declared in dsound.h.

See Also