SDL3 Mixer sound not looping

The code I have is effectively:

SDL_PropertiesID props;
SDL_SetNumberProperty(props, MIX_PROP_PLAY_LOOPS_NUMBER, 50);
MIX_PlayTrack(track, props);

however the sound only ever plays once, both with wav and ogg files. In the documentation for MIX_PROP_PLAY_LOOPS_NUMBER it says

If the input is not seekable and this value isn’t zero, this function will report success but the track will stop at the point it should loop

which is what I assume is happening here since MIX_PlayTrack is reporting success, but how do I tell if an audio file is seekable or not?

Have you forgot to use SDL_CreateProperties?

SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetNumberProperty(props, MIX_PROP_PLAY_LOOPS_NUMBER, 50);
MIX_PlayTrack(track, props);
SDL_DestroyProperties(props); // don't forget to also destroy the properties
2 Likes

Yeah, that was it actually, thanks.

1 Like