readWavesSpectrumInfoArr method

List<WavesSpectrumData> readWavesSpectrumInfoArr()

Implementation

List<WavesSpectrumData> readWavesSpectrumInfoArr() {
  final size = _readSpectrumArrSize();

  final wavesSpectrumDataPtr = calloc.allocate<NativeWavesSpectrumData>(sizeOf<NativeWavesSpectrumData>() * size);
  final sizePtr = calloc<Uint32>();
  sizePtr.value = size;

  try {
    bindings.SpectrumMathReadWavesSpectrumInfoArr(
      _pointer,
      wavesSpectrumDataPtr,
      sizePtr,
    );
    return List.generate(size, (index) => wavesSpectrumDataPtr[index].toManaged());
  } finally {
    calloc.free(wavesSpectrumDataPtr);
    calloc.free(sizePtr);
  }
}