aboutsummaryrefslogtreecommitdiff
path: root/sdl2/mixer
diff options
context:
space:
mode:
Diffstat (limited to 'sdl2/mixer')
-rw-r--r--sdl2/mixer/channels.ha20
-rw-r--r--sdl2/mixer/general.ha54
-rw-r--r--sdl2/mixer/samples.ha38
3 files changed, 0 insertions, 112 deletions
diff --git a/sdl2/mixer/channels.ha b/sdl2/mixer/channels.ha
deleted file mode 100644
index fffccd0..0000000
--- a/sdl2/mixer/channels.ha
+++ /dev/null
@@ -1,20 +0,0 @@
-use sdl2;
-
-@symbol("Mix_PlayChannelTimed") fn _Mix_PlayChannelTimed(
- channel: int,
- sample: *Mix_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 Mix_PlayChannelTimed(
- channel: int,
- sample: *Mix_Chunk,
- loops: int,
-) (void | sdl2::error) = {
- return sdl2::wrapvoid(_Mix_PlayChannelTimed(channel, sample, loops, -1));
-};
diff --git a/sdl2/mixer/general.ha b/sdl2/mixer/general.ha
deleted file mode 100644
index 87a729f..0000000
--- a/sdl2/mixer/general.ha
+++ /dev/null
@@ -1,54 +0,0 @@
-use sdl2;
-
-// Flags for [[init]].
-export type MIX_InitFlags = enum {
- FLAC = 0x00000001,
- MOD = 0x00000002,
- MP3 = 0x00000008,
- OGG = 0x00000010,
- MID = 0x00000020,
- OPUS = 0x00000040
-};
-
-// The default mixer has 8 simultaneous mixing channels
-export def MIX_CHANNELS: int = 8;
-
-// Good default frequency for a PC soundcard
-export def MIX_DEFAULT_FREQUENCY: int = 22050;
-
-// Good default channels for a PC soundcard
-export def MIX_DEFAULT_CHANNELS: int = 2;
-
-// XXX: This should choose MSB on a big-endian system:
-
-// Good default format for a PC soundcard
-export def MIX_DEFAULT_FORMAT: sdl2::SDL_AudioFormat = sdl2::AUDIO_S16LSB;
-
-@symbol("Mix_Init") fn _Mix_Init(flags: int) int;
-
-// Loads dynamic libraries and prepares them for use. Flags should be
-// one or more flags from [[MIX_InitFlags]] OR'd together.
-export fn Mix_Init(flags: MIX_InitFlags) (void | sdl2::error) = {
- if (flags & _Mix_Init(flags) != flags) {
- return "Mixer flags not initialized": sdl2::error;
- };
-};
-
-// Unloads libraries loaded with [[Mix_Init]].
-export @symbol("Mix_Quit") fn Mix_Quit() void;
-
-@symbol("Mix_OpenAudio") fn _Mix_OpenAudio(frequency: int,
- format: u16, channels: int, chunksize: int) int;
-
-// Open the mixer with a certain audio format
-export fn Mix_OpenAudio(
- frequency: int,
- format: sdl2::SDL_AudioFormat,
- channels: int,
- chunksize: int,
-) (void | sdl2::error) = {
- return sdl2::wrapvoid(_Mix_OpenAudio(frequency, format, channels, chunksize));
-};
-
-// Close the mixer, halting all playing audio
-export @symbol("Mix_CloseAudio") fn Mix_CloseAudio() void;
diff --git a/sdl2/mixer/samples.ha b/sdl2/mixer/samples.ha
deleted file mode 100644
index ad1ecc1..0000000
--- a/sdl2/mixer/samples.ha
+++ /dev/null
@@ -1,38 +0,0 @@
-use fs;
-use io;
-use os;
-use sdl2;
-
-// The internal format for an audio Mix_Chunk
-export type Mix_Chunk = struct {
- allocated: int,
- abuf: *u8,
- alen: u32,
- volume: u8,
-};
-
-@symbol("Mix_LoadWAV_RW") fn _Mix_LoadWAV_RW(src: *sdl2::SDL_RWops, freesrc: int) nullable *Mix_Chunk;
-
-// Loads a sample from an [[io::handle]].
-export fn Mix_LoadWAV_RW(src: io::handle) (*Mix_Chunk | sdl2::error) = {
- const rw = sdl2::rw_from_handle(src);
- return sdl2::wrapptr(_Mix_LoadWAV_RW(rw, 0))?: *Mix_Chunk;
-};
-
-// Loads a sample from a file path.
-export fn load_file(src: str) (*Mix_Chunk | fs::error | sdl2::error) = {
- const file = os::open(src)?;
- defer io::close(file)!;
- return Mix_LoadWAV_RW(file);
-};
-
-// Free the memory used in Mix_Chunk, and free Mix_Chunk itself as well. Do not use
-// Mix_Chunk after this without loading a new sample to it. Note: It's a bad idea to
-// free a Mix_Chunk that is still being played...
-export @symbol("Mix_FreeChunk") fn Mix_FreeChunk(Mix_Chunk: *Mix_Chunk) void;
-
-// Maximum volume for a Mix_Chunk.
-export def MIX_MAX_VOLUME: int = 128; // XXX: SDL_mixer derives this from SDL_MIX_MAXVOLUME
-
-// Sets the Mix_Chunk volume as specified, returning the previous value.
-export @symbol("Mix_VolumeChunk") fn Mix_VolumeChunk(Mix_Chunk: *Mix_Chunk, volume: int) int;