mixHasChunkDecoder function

bool mixHasChunkDecoder(
  1. String? name
)

Check if a chunk decoder is available by name.

This result can change between builds AND runs of the program, if external libraries that add functionality become available. You must successfully call Mix_OpenAudio() or Mix_OpenAudioDevice() before calling this function, as decoders are activated at device open time.

Decoder names are arbitrary but also obvious, so you have to know what you're looking for ahead of time, but usually it's the file extension in capital letters (some example names are "AIFF", "VOC", "WAV").

\param name the decoder name to query. \returns SDL_TRUE if a decoder by that name is available, SDL_FALSE otherwise.

\since This function is available since SDL_mixer 2.0.2.

\sa Mix_GetNumChunkDecoders \sa Mix_GetChunkDecoder

extern DECLSPEC SDL_bool SDLCALL Mix_HasChunkDecoder(const char *name)

Implementation

bool mixHasChunkDecoder(String? name) {
  final mixHasChunkDecoderLookupFunction = libSdl2Mixer.lookupFunction<
      Int32 Function(Pointer<Utf8> name),
      int Function(Pointer<Utf8> name)>('Mix_HasChunkDecoder');
  final namePointer = name != null ? name.toNativeUtf8() : nullptr;
  final result = mixHasChunkDecoderLookupFunction(namePointer) == 1;
  calloc.free(namePointer);
  return result;
}