From eae63b218494d3aa077a9ea196abc4c5096e016b Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Sun, 12 Dec 2021 13:56:23 +0100 Subject: sdl2::mixer: implement channel playback --- sdl2/mixer/channels.ha | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 sdl2/mixer/channels.ha (limited to 'sdl2/mixer/channels.ha') diff --git a/sdl2/mixer/channels.ha b/sdl2/mixer/channels.ha new file mode 100644 index 0000000..4bf4820 --- /dev/null +++ b/sdl2/mixer/channels.ha @@ -0,0 +1,20 @@ +use sdl2; + +@symbol("Mix_PlayChannelTimed") fn _play_channel_timed( + channel: int, + sample: *chunk, + loops: int, + ticks: int, +) int; + +// Play chunk on channel, or if channel is -1, pick the first free unreserved +// channel. The sample will play for loops+1 number of times, unless stopped by +// halt, or fade out, or setting a new expiration time of less time than it +// would have originally taken to play the loops, or closing the mixer. +export fn play_channel( + channel: int, + sample: *chunk, + loops: int, +) (void | sdl2::error) = { + return sdl2::wrapvoid(_play_channel_timed(channel, sample, loops, -1)); +}; -- cgit v1.2.3