XaudioSampleBuffer XaudioCreateSampleBuffer(Display *display, unsigned int size);
void XaudioFreeSampleBuffer(Display *display , XaudioSampleBuffer buffer);
void XaudioSampleBufferSetBase(Display *display, XaudioSampleBuffer buffer, int offset);
void XaudioSampleBufferShiftBase(Display *display, XaudioSampleBuffer buffer, int rel_offset);
void XaudioPutSamples(Display *display, XaudioSampleBuffer buffer, unsigned int index, const void *data, unsigned int nsamples, unsigned int format);
void XaudioGetSamples(Display *display, XaudioSampleBuffer buffer, unsigned int index, void *data, unsigned int nsamples, unsigned int format);
void XaudioSampleBufferGetInfo(Display *display, XaudioSampleBuffer buffer, unsigned int *size, unsigned int *base);
Each sample can individually be addressed through its index. A sample buffer always stores size sample values with indices base, base+1, ... , base+size-1, where initially base=0. Write operations to any of these indices will modify the corresponding sample value, read operations will return the previously written value. Write operations to an index outside of this range will be silently discarded, read operations will yield 0. The base sample index of a sample buffer can be modified through the XaudioSampleBufferSetBase and XaudioSampleBufferShiftBase functions (which set a new absolute value or shift it with respect to its old base value, respectively). Any samples inside the intersection of old and new sample index ranges will be unaffected, all other samples will be set to zero.
The XaudioPutSamples function allows to upload samples from the client application into a server-side sample buffer. The format parameter indicates how data should be interpreted:
The new values will replace the previous values of the samples with indices index, index+1, ... index+nsamples-1.
Conversely, XaudioGetSamples allows to transfer sample values stored in a server-side buffer to the client. If sample values cannot be represented in the desired format they are clamped to the maximum range supported by the format.
The XaudioSampleBufferGetInfo function returns the number of samples stored as well as the current base index.