v2026.6.4
All Bundles
Bundle SDL2 multimedia library for 2D graphics, input handling, audio playback, and window management. Core types: Window, Renderer, Texture, Surface, Event, and Mixer. Compile with -lib sdl2.

MixChunk

Format for an audio chunk

Operations

FadeInChannel #

Fade in sample

method : public : FadeInChannel(channel:Int, loops:Int, ms:Int) ~ Int

Parameters

NameTypeDescription
channelIntchannel to play on, or -1 for the first free unreserved channel.
loopsIntnumber of loops, -1 is infinite loops. Passing one here plays the sample twice (1 loop).
msIntmilliseconds of time that the fade-in effect should take to go from silence to full volume.

Return

TypeDescription
Intchannel the sample is played on

FadeInChannelTimed #

Fade in sample

method : public : FadeInChannelTimed(channel:Int, loops:Int, ms:Int, ticks:Int) ~ Int

Parameters

NameTypeDescription
channelIntchannel to play on, or -1 for the first free unreserved channel.
loopsIntnumber of loops, -1 is infinite loops. Passing one here plays the sample twice (1 loop).
msIntmilliseconds of time that the fade-in effect should take to go from silence to full volume.
ticksIntmillisecond limit to play sample, at most

Return

TypeDescription
Intchannel the sample is played on

Free #

Free the memory used in chunk, and free chunk itself as well.

method : public : Free() ~ Nil

IsNull #

Determines if the underlying SDL C-struct is NULL

method : public : IsNull() ~ Bool

Return

TypeDescription
Booltrue if NULL, false otherwise

New # constructor

Load file for use as a sample

New(file:String)

Parameters

NameTypeDescription
fileStringfile name to load sample from

PlayChannel #

Play chunk on channel

method : public : PlayChannel(channel:Int, loops:Int) ~ Int

Parameters

NameTypeDescription
channelIntto play on, or -1 for the first free unreserved channel.
loopsIntnumber of loops, -1 is infinite loops. Passing one here plays the sample twice

Return

TypeDescription
Intthe channel the sample is played on

PlayChannelTimed #

Play chunk on channel

method : public : PlayChannelTimed(channel:Int, loops:Int, ticks:Int) ~ Int

Parameters

NameTypeDescription
channelIntto play on, or -1 for the first free unreserved channel.
loopsIntNumber of loops, -1 is infinite loops
ticksIntmillisecond limit to play sample, at most

Return

TypeDescription
Intthe channel the sample is played on