Crate sdl3_mixer_sys

Crate sdl3_mixer_sys 

Source
Expand description

§sdl3-mixer-sys: Low level Rust bindings for SDL3_mixer

This version is a prerelease. There may be breaking changes before the final 0.6.0 release.

These are low level Rust bindings for SDL3_mixer, an add-on library for SDL 3 for loading and playing audio files. This version of sdl3-mixer-sys has bindings for SDL_mixer version 3.1.2-prerelease.

Most of the docs are generated directly from the C headers and document how SDL works in C. Using it from Rust might work differently in some cases. For example, macros in C are usually translated to constants or constant functions in Rust. Documentation specific to these Rust bindings are tagged with sdl3-sys.

Browse the API at docs.rs!

§Usage

sdl3-mixer-sys is compatible with SDL_mixer version 3.2.0 or later. Some APIs may require later versions; you can check availability in the documentation. The latest available stable release is recommended.

By default, sdl3-mixer-sys will attempt to link to a dynamic/shared library named SDL3_mixer in the default library search path, using the usual platform specific naming convention for libraries. You can change this behaviour with the following feature flags.

FeatureDescription
use-pkg-configUse pkg-config to find and link the SDL_mixer library.
use-vcpkgUse vcpkg to find and link the SDL_mixer library.
build-from-sourceBuild and link SDL_mixer from source. You have to install any dependencies SDL needs to build for your target first. See below for build related features.
build-from-source-staticShortcut for enabling both the build-from-source and link-static features. This should no longer be necessary.
build-static-vendoredBuild and link SDL_mixer from source, use vendored libraries (see below), and link it all statically.
link-frameworkLink to a framework on Apple targets. This currently requires SDL3_mixer.xcframework to be located at ~/Library/Frameworks or /Library/Frameworks. The built executable has to be put in a signed app bundle to be able to run.
link-staticLink SDL_mixer statically.
no-linkDon’t link anything, and provide linking flags via Cargo metadata so you can do manual linking if desired.

§Building from source

When building from source with the build-from-source feature flag, you can use features to configure which audio formats to support. Features marked with “(cmake)” below all have an sdlmixer- prefix and correspond to SDL_mixer’s cmake variables. They’re autodetected if not set. You can use a no- prefix to disable a cmake feature, for example no-sdlmixer-mp3-drmp3 disables mp3 support via the drmp3 library. Activated features override features disabled with the no- prefix.

§Defaults

Formats are autodetected by default. You can disable them by default instead and enable only the formats you want.

(These are not cmake features)

FeatureDescription
no-default-formatsDisable all formats by default
no-default-aiffDisable AIFF by default
no-default-waveDisable WAVE by default
no-default-vocDisable VOC by default
no-default-auDisable AU by default
no-default-flacDisable FLAC by default
no-default-gmeDisable GME by default
no-default-modDisable MOD by default
no-default-mp3Disable MP3 by default
no-default-midiDisable MIDI by default
no-default-opusDisable Opus by default
no-default-vorbisDisable Vorbis by default
no-default-wavpackDisable Wavpack by default
§Linking and vendoring
Feature (cmake)Description
vendoredBuild dependencies from source as part of building SDL_mixer
deps-sharedUse shared libraries for dependencies. You can also enable this for select libraries only, see below
§Formats
Feature (cmake)Description
aiffEnable AIFF support (built-in)
waveEnable WAVE support (built-in)
vocEnable VOC support (built-in)
auEnable AU support (built-in)
flac-libflacEnable FLAC support via libflac
flac-drflacEnable FLAC support via dr_flac
gmeEnable GME support via libgme
mod-xmpEnable MOD support via libxmp
mod-xmp-liteEnable MOD support via libxmp-lite
mp3-drmp3Enable MP3 support via dr_mp3
mp3-mpg123Enable MP3 support via libmpg123
midi-fluidsynthEnable MIDI support via libfluidsynth
midi-timidityEnable MIDI support via timidity
opusEnable Opus support via libopus
vorbis-stbEnable Vorbis support via stb
vorbis-vorbisfileEnable Vorbis support via vorbisfile
vorbis-tremorEnable Vorbis support via libvorbisidec (tremor)
wavpackEnable Wavpack support
wavpack-dsdEnable Wavpack DSD support
§Shared linking
Feature (cmake)Description
flac-libflac-sharedLink libflac shared. Implies flac-libflac
gme-sharedLink libgme shared. Imples gme
mod-xmp-sharedLink libxmp/libxmp-lite shared. Implies mod-xmp (enable mod-xmp-lite to use lite instead)
mp3-mpg123-sharedLink libmpg123 shared. Implies mp3-mpg123
midi-fluidsynth-sharedLink libfluidsynth shared. Imples midi-fluidsynth
opus-sharedLink libopus shared. Implies opus
vorbis-vorbisfile-sharedLink vorbisfile shared. Implies vorbis-vorbisfile
vorbis-tremor-sharedLink libvorbisidec shared. Imples vorbis-tremor
wavpack-sharedLink wavpack shared. Implies wavpack

§Other features

FeatureDescription
debug-implsImplement the Debug trait for most SDL_mixer types.
metadataEnable metadata. Also see only-metadata.
only-metadataShortcut for enabling both the metadata and no-link features. Recommended when you need metadata but don’t need to call into SDL_mixer, e.g. for build scripts.

§Recent changes

  • 0.6.0-pre-0:
    • Prerelease

See ChangeLog.md for older changes

Modules§

mixer
SDL_mixer is a library to make complicated audio processing tasks easier.