Defined in carb/audio/IAudioCapture.h

struct LockRegion

stores the buffer information for gaining access to a buffer of raw audio data.

A buffer of audio data is a linear buffer that may wrap around if it is set to loop. If the requested lock region extends past the end of the buffer, it will wrap around to the beginning by returning a second pointer and length as well. If the lock region does not wrap around, only the first pointer and length will be returned. The second pointer will be nullptr and the second length will be 0.

The interpretation of this buffer is left up to the caller that locks it. Since the lock regions point to the raw audio data, it is the caller’s responsibility to know the data’s format (ie: bits per sample) and channel count and interpret them properly. The data format information can be collected with the IAudioCapture::getSoundFormat() call.

Note that these returned pointers are writable. It is possible to write new data to the locked regions of the buffer (for example, clearing the buffer for security purposes after reading), but it is generally not advised or necessary. If the capture buffer is looping, the contents will quickly be overwritten soon anyway.

Public Members

void *ptr1

pointer to the first chunk of locked audio data.

This will always be non-nullptr on a successful lock operation. This will point to the first byte of the requested frame offset in the audio buffer.

size_t len1

The length of ptr1 in frames.

void *ptr2

pointer to the second chunk of locked audio data.

This will be nullptr on a successful lock operation if the requested lock region did not wrap around the end of the capture buffer. This will always point to the first byte in the audio buffer if it is non-nullptr.

size_t len2

The length of ptr2 in frames.