Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
The IDirectSoundCaptureBuffer::Lockmethod locks the buffer. Locking the buffer returns pointers into the buffer, allowing the application to read or write audio data into that memory.
HRESULT Lock( DWORD dwReadCursor , DWORD dwReadBytes , LPVOID * lplpvAudioPtr1 , LPDWORD lpdwAudioBytes1 , LPVOID * lplpvAudioPtr2 , LPDWORD lpdwAudioBytes2 , DWORD dwFlags );
Parameters
Flag | Description |
---|---|
DSCBLOCK_ENTIREBUFFER | The dwReadBytesparameter is to be ignored and the entire capture buffer is to be locked. |
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 values:
DSERR_INVALIDPARAM
DSERR_INVALIDCALL
Remarks
This method accepts an offset and a byte count, and returns two read pointers and their associated sizes. Two pointers are required because capture buffers are circular. If the locked bytes do not wrap around the end of the buffer, the second pointer, lplpvAudioBytes2, will be NULL. However, if the bytes do wrap around, then the second pointer will point to the beginning of the buffer.
If the application passes NULL for the lplpvAudioPtr2and lpdwAudioBytes2parameters, DirectSoundCapture will not lock the wraparound portion of the buffer.
The application should read data from the pointers returned by the IDirectSoundCaptureBuffer::Lockmethod and then call the IDirectSoundCaptureBuffer::Unlockmethod to release the buffer back to DirectSoundCapture. The sound buffer should not be locked for long periods of time; if it is, the capture cursor will reach the locked bytes and configuration-dependent audio problems may result.
Requirements
Runs On | Versions | Defined in | Include | Link to |
---|---|---|---|---|
Windows CE OS | 2.12 or later. Version 2.12 requires DXPAK 1.0 or later. | dsound.h | dsound.lib |
Note This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.