Existing allocated buffer. Can be null. Input slice length is not considered.
Desired slice length.
Alignement if the slice has allocation requirements, 1 else. Must match for deallocation.
import std.stdio; struct MyDSP { nothrow @nogc: void initialize(int maxFrames) { // mybuf points to maxFrames frames mybuf.reallocBuffer(maxFrames); } ~this() { // If you don't free the buffer, it will leak. mybuf.reallocBuffer(0); } private: float[] mybuf; }
Used throughout dplug:dsp to avoid reliance on GC. Important: Size 0 is special-case to free the slice. This works a bit like alignedRealloc except with slices as input. You MUST use consistent alignement thoughout the lifetime of this buffer.