Skip to content

Buffer

Internal FFI helpers for the Symphonia package, so the decoder never touches stdPolyfills.ffi directly.

Zune does not write back through a Luau buffer passed as a pointer, so everything libsymphonia writes into (PCM, packets, names and error text) is native memory from alloc. Inputs (file bytes, paths and extensions) are passed as Luau buffers, which Zune reads directly.

Buffer . alloc ( size )  -> FFIPointer

Allocates size bytes of native memory from the pooled allocator.

Parameters

size: number

Returns

FFIPointer
Buffer . free ( pointer )  -> ()

Returns native memory from alloc to the pool.

Parameters

pointer: FFIPointer
Buffer . read ( pointer ,  length )  -> buffer

Copies the first length bytes at pointer into a new Luau buffer.

Parameters

pointer: FFIPointer
length: number

Returns

buffer
Buffer . getNull ( )  -> FFIPointer

Returns the null pointer, for an optional pointer argument left out.

Returns

FFIPointer
Buffer . fromCString ( pointer ,  capacity )  -> string

Reads the NUL-terminated string at pointer, at most capacity bytes long.

Parameters

pointer: FFIPointer
capacity: number

Returns

string
Buffer . cString ( text )  -> buffer

Returns text with a NUL terminator as a Luau buffer, to pass as a C string.

Parameters

text: string

Returns

buffer