sdl3_mixer-on-zig
SDL3_Mixer on Zig
This repository wraps the upstream SDL3_Mixer library source code with Zig’s build system.
Zig 0.15.2 is required.
The build setup support the following audio decoders:
- FLAC through dr_flac
- GME’s formats
- MIDI through TiMidity
- Module/tracker music through XMP
- MP3 through dr_mp3
- Opus
- Vorbis
It also uses castholm’s SDL3 port by default.
Installing as a build.zig.zon package
Run in your Zig project:
zig fetch --save-exact=sdl3_mixer git+https://github.com/lateleite/sdl3_mixer-on-zig.git
Then in your build.zig file:
pub fn build(b: *std.Build) !void {
// ...
// Add a reference to the package you've just fetched...
const dep_mixer = b.dependency("sdl3_mixer", .{
.target = target,
.optimize = optimize,
// you may choose to use your system's SDL3 library,
// instead of building and statically linking another.
//.@"use-system-sdl" = false,
});
const lib_mixer = dep_mixer.artifact("SDL_mixer");
// ...then link the library to your module
your_module.linkLibrary(lib_mixer);
// ...
}
After that, you may use SDL3_Mixer’s header files in your module.
License
All (build) code here is released to public domain or under the BSD Zero Clause license, choose whichever you prefer.
You may find SDL3_Mixer’s license at https://github.com/libsdl-org/SDL_mixer/blob/8c52ef985c3c6495fcb5cf7a118aa544388c2765/LICENSE.txt.