mixPlayTag function mixer
Start (or restart) mixing all tracks with a specific tag for playback.
This function follows all the same rules as MIX_PlayTrack(); please refer to its documentation for the details. Unlike that function, MIX_PlayTag() operates on multiple tracks at once that have the specified tag applied, via MIX_TagTrack().
If all of your tagged tracks have different sample rates, it would make
sense to use the *_MILLISECONDS_NUMBER properties in your options,
instead of *_FRAMES_NUMBER, and let SDL_mixer figure out how to apply it
to each track.
This function returns true if all tagged tracks are started (or restarted). If any track fails, this function returns false, but all tracks that could start will still be started even when this function reports failure.
From the point of view of the mixing process, all tracks that successfully (re)start will do so at the exact same moment.
\param mixer the mixer on which to look for tagged tracks. \param tag the tag to use when searching for tracks. \param options the set of options that will be applied to each track. \returns true on success, false on error; call SDL_GetError() for details.
\threadsafety It is safe to call this function from any thread.
\since This function is available since SDL_mixer 3.0.0.
\sa MIX_PlayTrack \sa MIX_TagTrack \sa MIX_StopTrack \sa MIX_PauseTrack \sa MIX_TrackPlaying
extern SDL_DECLSPEC bool SDLCALL MIX_PlayTag(MIX_Mixer *mixer, const char *tag, SDL_PropertiesID options)
Implementation
bool mixPlayTag(Pointer<MixMixer> mixer, String? tag, int options) {
final mixPlayTagLookupFunction = _libMixer
.lookupFunction<
Uint8 Function(
Pointer<MixMixer> mixer,
Pointer<Utf8> tag,
Uint32 options,
),
int Function(Pointer<MixMixer> mixer, Pointer<Utf8> tag, int options)
>('MIX_PlayTag');
final tagPointer = tag != null ? tag.toNativeUtf8() : nullptr;
final result = mixPlayTagLookupFunction(mixer, tagPointer, options) == 1;
calloc.free(tagPointer);
return result;
}