table of contents
- experimental 3~git20250302~78a2035+ds-1
Mix_PlayChannelTimed(3) | SDL_mixer3 FUNCTIONS | Mix_PlayChannelTimed(3) |
NAME¶
Mix_PlayChannelTimed - Play an audio chunk on a specific channel for a maximum time.
HEADER FILE¶
Defined in SDL3_mixer/SDL_mixer.h
SYNOPSIS¶
#include "SDL3_mixer/SDL_mixer.h"
int Mix_PlayChannelTimed(int channel, Mix_Chunk *chunk, int loops, int ticks);
DESCRIPTION¶
If the specified channel is -1, play on the first free channel (and return -1 without playing anything new if no free channel was available).
If a specific channel was requested, and there is a chunk already playing there, that chunk will be halted and the new chunk will take its place.
If loops is greater than zero, loop the sound that many times. If loops is -1, loop "infinitely" (~65000 times). ticks specifies the maximum number of milliseconds to play this chunk before halting it. If you want the chunk to play until all data has been mixed, specify -1.
Note that this function does not block for the number of ticks requested; it just schedules the chunk to play and notes the maximum for the mixer to manage later, and returns immediately.
FUNCTION PARAMETERS¶
RETURN VALUE¶
Returns which channel was used to play the sound, or -1 if sound could not be played.
AVAILABILITY¶
This function is available since SDL_mixer 3.0.0.
SDL_mixer 3.0.0 | SDL_mixer |