Scroll to navigation

Mix_HookMusicFinished(3) SDL_mixer3 FUNCTIONS Mix_HookMusicFinished(3)

NAME

Mix_HookMusicFinished - Set a callback that runs when a music object has stopped playing.

HEADER FILE

Defined in SDL3_mixer/SDL_mixer.h

SYNOPSIS

#include "SDL3_mixer/SDL_mixer.h"
void Mix_HookMusicFinished(Mix_MusicFinishedCallback music_finished);

DESCRIPTION

This callback will fire when the currently-playing music has completed, or when it has been explicitly stopped from a call to

Mix_HaltMusic . As such, this callback might fire from an arbitrary background thread at almost any time; try to limit what you do here.

It is legal to start a new music object playing in this callback (or restart the one that just stopped). If the music finished normally, this can be used to loop the music without a gap in the audio playback.

A NULL pointer will disable the callback.

FUNCTION PARAMETERS

the callback function to become the new notification mechanism.

AVAILABILITY

This function is available since SDL_mixer 3.0.0.

SDL_mixer 3.0.0 SDL_mixer