Share via


AudioBufferList Struct

Definition

This struct represents the native AudioBufferList struct.

public readonly ref struct AudioBufferList
type AudioBufferList = struct
Inheritance
AudioBufferList

Remarks

Typically it's better to use the AudioBuffers class to wrap a pointer to a native AudioBufferList, but some audio code needs to minimize memory allocations due to being executed in a realtime thread. In that case, using this struct is better, because it's possible to use it without incurring any memory allocations.

Note that this struct should never be created in C#, the only valid way to use it is to cast a pointer (IntPtr) to a pointer of this struct:

public unsafe static void Callback (IntPtr audioBufferListPtr) {
    AudioBufferList* audioBufferList = (AudioBufferList* ) audioBufferListPtr;
    for (var i = 0; i < audioBufferList->Count; i++) {
        AudioBuffer* buffer = audioBufferList->GetBuffer (index),
        // Use the buffer for something
    }
}

Properties

Name Description
Count

Returns the number of audio buffers in this list.

Methods

Name Description
GetBuffer(Int32)

Return a pointer to the AudioBuffer at the specified index.

Applies to