module

Tryst::SDL::PlayOptions

@api private

Builds the SDL_PropertiesID that MIX_PlayTrack and MIX_PlayTag take their options from. SDL3 passes optional arguments as a property bag rather than as parameters, so "play this looping with a 200ms fade" means creating a bag, filling it and destroying it again.

Shared between Track#play and Mixer#play_tag, which accept exactly the same options because they are the same call underneath, applied to one track or to every track carrying a tag.

Constants

PROP_FADE_IN_MS = "SDL_mixer.play.fade_in_milliseconds"
PROP_LOOPS = "SDL_mixer.play.loops"

Property names, spelled out because Crystal never sees the MIX_PROP_PLAY_* macros in the header.

PROP_START_MS = "SDL_mixer.play.start_millisecond"

Class methods

build(loops : Int32, fade_ms : Int32, start_ms : Int32) : LibSDL::PropertiesID
Source
with(loops : Int32, fade_ms : Int32, start_ms : Int32, &)

Yields the property id and destroys it afterwards. Zero when every option is at its default - SDL reads 0 as "use the defaults", so the common case allocates nothing at all.

Source