DSDM_LOCK

This message is called to obtain a valid write pointer to the sound buffer audio data.

typedef struct {
  DWORD dwMsg;
  DWORD dwInstance;
  DWORD dwOffset;
  DWORD dwCount;
  LPVOID* ppBuffer1;
  LPDWORD pdwCount1;
  LPVOID* ppBuffer2;
  LPDWORD pdwCount2;
  DWORD dwFlags;
} DSDMP_LOCK;

Members

  • dwMsg
    Equals DSDM_LOCK.
  • dwInstance
    DirectSoundBuffer instance data.
  • dwOffset
    The position relative to the start of the buffer that should be locked and therefore subject to change by the locking application.
  • dwCount
    The number of bytes relative to the write position that will be locked, and therefore subject to change by the locking application.
  • ppBuffer1
    Pointer to a value that the driver must fill with a pointer to the first block of sound data.
  • pdwCount1
    Pointer to a DWORD that the driver must fill with the number of bytes pointed to by *ppBuffer1.
  • ppBuffer2
    Pointer to a value that the driver must fill with a pointer to the second block of sound data. If the first block points to the entire block of requested data, this value should be set to NULL.
  • pdwCount2
    Pointer to a DWORD that the driver must fill with the number of bytes pointed to by *ppBuffer2. If *ppBuffer2 is NULL, this value must be set to zero.
  • dwFlags
    Flag for modifying the lock event. The following table shows the possible values for dwFlags.
    Flag Description
    DSBLOCK_FROMWRITECURSOR Locks from the current write position, making a call to IdirectSoundBuffer::GetCurrentPosition unnecessary.
    DSBLOCK_ENTIREBUFFER Locks the entire buffer.

Return Values

Returns DS_OK if successful, or one of the following error values otherwise.

Error value Description
DSERR_INVALIDCALL This call is not valid for the current state of this object.
DSERR_INVALIDPARAM An invalid parameter was passed to the returning function.
DSERR_BUFFERLOST The buffer memory has been lost and must be restored.

Remarks

This method accepts an offset as well as a specific count of bytes, and the driver returns two write pointers and their associated sizes. Two pointers are required because sound buffers are circular. If the locked bytes do not wrap around the end of the buffer, the second pointer should be NULL. However, if the bytes do wrap around, the second pointer should point to the beginning of the buffer.

Requirements

OS Versions: Windows CE .NET 4.0 and later.
Header: Dsdriver.h.

See Also

DirectSound Driver Messages

 Last updated on Tuesday, May 18, 2004

© 1992-2003 Microsoft Corporation. All rights reserved.