Contents

class

SushiDSP::BufferPool

Fixed-capacity pool of block-sized float buffers with allocation-free acquire/release.

Declared in
include/SushiDSP/core/BufferPool.hpp

Public member functions

BufferPool(std::uint32_t block_size, std::uint32_t max_live_buffers)

Preallocates max_live_buffers buffers of block_size floats each.

Parameters

block_size

Number of floats per buffer.

max_live_buffers

Maximum number of buffers live at once.

float * acquire(std::uint32_t frames)

Returns a buffer of at least frames floats, or nullptr if the pool is exhausted.

Parameters

frames

Number of frames the caller needs.

Returns

Pointer to a block_size-float buffer, or nullptr.

void release(float *buffer)

Returns a buffer obtained from acquire() to the pool.

Parameters

buffer

A pointer acquire() returned.

std::uint32_t capacity() const

The maximum number of buffers that can be live at once.

Returns

The pool capacity in buffers.