mixGetMusicTitle function

String? mixGetMusicTitle(
  1. Pointer<MixMusic> music
)

Get the title for a music object, or its filename.

This returns format-specific metadata. Not all file formats supply this!

If music is NULL, this will query the currently-playing music.

If music's title tag is missing or empty, the filename will be returned. If you'd rather have the actual metadata or nothing, use Mix_GetMusicTitleTag() instead.

Please note that if the music was loaded from an SDL_IOStream instead of a filename, the filename returned will be an empty string ("").

This function never returns NULL! If no data is available, it will return an empty string ("").

\param music the music object to query, or NULL for the currently-playing music. \returns the music's title if available, or the filename if not, or "".

\since This function is available since SDL_mixer 3.0.0.

\sa Mix_GetMusicTitleTag \sa Mix_GetMusicArtistTag \sa Mix_GetMusicAlbumTag \sa Mix_GetMusicCopyrightTag

extern SDL_DECLSPEC const char *SDLCALL Mix_GetMusicTitle(const Mix_Music *music)

Implementation

String? mixGetMusicTitle(Pointer<MixMusic> music) {
  final mixGetMusicTitleLookupFunction = libSdl3Mixer.lookupFunction<
      Pointer<Utf8> Function(Pointer<MixMusic> music),
      Pointer<Utf8> Function(Pointer<MixMusic> music)>('Mix_GetMusicTitle');
  final result = mixGetMusicTitleLookupFunction(music);
  if (result == nullptr) {
    return null;
  }
  return result.toDartString();
}