|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 IDsDriverBuffer::Unlockmethod releases a block of sound data to the driver. The driver should perform whatever actions are necessary to output the audio data to the sound device.
HRESULT Unlock( LPVOID pvAudio1 , DWORD dwLen1 , LPVOID pvAudio2 , DWORD dwLen2 );
Returns DS_OK if successful, or one of the following error values otherwise:
The data block is actually described by two pointers; both are required because sound buffers are circular. If the locked bytes do not wrap around the end of the buffer, the second pointer ( pvAudio2) is NULL. However, if the bytes do wrap around, then the second pointer points to the beginning of the buffer.
Each call to IDsDriverBuffer::Unlockis preceded by a corresponding call to IDsDriverBuffer::Lock. The pointer parameters are always the same pointers as those returned by IDsDriverBuffer::Lock. However, the number of bytes unlocked may be less than the number of bytes locked if the application does not fill the locked region. See IDsDriverBuffer::Lockfor more details.
For some devices (such as DMA-based cards that do not support hardware secondary buffers), repeated calls to IDsDriverBuffer::Lockand IDsDriverBuffer::Unlockare unnecessary. In this case, the driver should specify the DSDCAPS_DONTNEEDLOCK flag in the DSDRIVERDESCstructure returned by IDsDriver::GetDriverDescmethod. If this flag is specified, then the IDsDriverBuffer::Unlockmethod is never called by DirectSound. In that case, the IDsDriverBuffer::Unlockmethod should simply return DSERR_UNSUPPORTED.
Last updated on Tuesday, July 13, 2004