Platform SDK: DirectX

Capture Buffer Information

[C++]

Use the IDirectSoundCaptureBuffer::GetCaps method to retrieve the size of a capture buffer. Be sure to initialize the dwSize member of the DSCBCAPS structure before passing it as a parameter. You can also retrieve information about the format of the data in the buffer, as set when the buffer was created. Call the IDirectSoundCaptureBuffer::GetFormat method, which returns the format information in a WAVEFORMATEX structure. For more information on this structure, see Sound Data.

Note that your application can allow for extra format information in the WAVEFORMATEX structure by first calling the GetFormat method with NULL as the lpwfxFormat parameter. In this case the DWORD pointed to by the lpdwSizeWritten parameter will receive the size of the structure needed to receive complete format information.

To find out what a capture buffer is currently doing, call the IDirectSoundCaptureBuffer::GetStatus method. This method fills a DWORD variable with a combination of flags that indicate whether the buffer is busy capturing, and if so, whether it is looping; that is, whether the DSCBSTART_LOOPING flag was set in the last call to IDirectSoundCaptureBuffer::Start.

Finally, the IDirectSoundCaptureBuffer::GetCurrentPosition method returns the current read and capture positions within the buffer. The read position is the end of the data that has been captured into the buffer at this point. The capture position is the end of the block of data that is currently being copied from the hardware. You can safely copy data from the buffer only up to the read position.

[Visual Basic]

Use the DirectSoundCaptureBuffer.GetCaps method to retrieve information about buffer capabilities. To get information about the data format of the buffer, which was set when the buffer was created, call the DirectSoundCaptureBuffer.GetFormat method.

To find out what a capture buffer is doing, call the DirectSoundCaptureBuffer.GetStatus method. This method returns a combination of flags that indicate whether the buffer is busy capturing, and if so, whether it is looping; that is, whether the DSCBSTART_LOOPING flag was set in the last call to DirectSoundCaptureBuffer.Start.

Finally, the DirectSoundCaptureBuffer.GetCurrentPosition method returns the current read and capture positions within the buffer. The read position is the end of the data that has been captured into the buffer at this point. The capture position is the end of the block of data that is being copied from the hardware. You can safely copy data from the buffer only up to the read position.