sdlxSetAudioStreamFormat function

bool sdlxSetAudioStreamFormat(
  1. Pointer<SdlAudioStream> stream,
  2. SdlxAudioSpec? srcSpec,
  3. SdlxAudioSpec? dstSpec
)

Implementation

bool sdlxSetAudioStreamFormat(
  Pointer<SdlAudioStream> stream,
  SdlxAudioSpec? srcSpec,
  SdlxAudioSpec? dstSpec,
) {
  Pointer<SdlAudioSpec> srcSpecPointer = nullptr;
  Pointer<SdlAudioSpec> dstSpecPointer = nullptr;
  if (srcSpec != null) {
    srcSpecPointer = srcSpec.calloc();
  }
  if (dstSpec != null) {
    dstSpecPointer = dstSpec.calloc();
  }
  final result = sdlSetAudioStreamFormat(
    stream,
    srcSpecPointer,
    dstSpecPointer,
  );
  if (srcSpecPointer != nullptr) {
    srcSpecPointer.callocFree();
  }
  if (dstSpecPointer != nullptr) {
    dstSpecPointer.callocFree();
  }
  return result;
}