mirror of
https://github.com/touchHLE/rust-sdl2.git
synced 2026-01-31 01:25:23 +01:00
Convert SDL_mixer bindings into autogenerated bindings
Progresses on #647
This commit is contained in:
@@ -4,7 +4,7 @@ extern crate sdl2;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use sdl2::mixer::{DEFAULT_CHANNELS, INIT_MP3, INIT_FLAC, INIT_MOD, INIT_FLUIDSYNTH, INIT_MODPLUG,
|
||||
use sdl2::mixer::{DEFAULT_CHANNELS, INIT_MP3, INIT_FLAC, INIT_MOD,
|
||||
INIT_OGG, AUDIO_S16LSB};
|
||||
|
||||
fn main() {
|
||||
@@ -33,7 +33,7 @@ fn demo(music_file: &Path, sound_file: Option<&Path>) {
|
||||
let chunk_size = 1_024;
|
||||
sdl2::mixer::open_audio(frequency, format, channels, chunk_size).unwrap();
|
||||
let _mixer_context = sdl2::mixer::init(
|
||||
INIT_MP3 | INIT_FLAC | INIT_MOD | INIT_FLUIDSYNTH | INIT_MODPLUG | INIT_OGG
|
||||
INIT_MP3 | INIT_FLAC | INIT_MOD | INIT_OGG
|
||||
).unwrap();
|
||||
|
||||
// Number of mixing channels available for sound effect `Chunk`s to play
|
||||
|
||||
@@ -287,6 +287,9 @@ fn copy_pregenerated_bindings() {
|
||||
|
||||
fs::copy(crate_path.join("sdl_ttf_bindings.rs"), out_path.join("ttf_bindings.rs"))
|
||||
.expect("Couldn't find pregenerated SDL_ttf bindings!");
|
||||
|
||||
fs::copy(crate_path.join("sdl_mixer_bindings.rs"), out_path.join("mixer_bindings.rs"))
|
||||
.expect("Couldn't find pregenerated SDL_mixer bindings!");
|
||||
}
|
||||
|
||||
#[cfg(feature = "bindgen")]
|
||||
@@ -297,6 +300,7 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
|
||||
let mut bindings = bindgen::Builder::default();
|
||||
let mut image_bindings = bindgen::Builder::default();
|
||||
let mut ttf_bindings = bindgen::Builder::default();
|
||||
let mut mixer_bindings = bindgen::Builder::default();
|
||||
|
||||
// Set correct target triple for bindgen when cross-compiling
|
||||
if target != host {
|
||||
@@ -308,6 +312,9 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
|
||||
|
||||
ttf_bindings = ttf_bindings.clang_arg("-target");
|
||||
ttf_bindings = ttf_bindings.clang_arg(target.clone());
|
||||
|
||||
mixer_bindings = mixer_bindings.clang_arg("-target");
|
||||
mixer_bindings = mixer_bindings.clang_arg(target.clone());
|
||||
}
|
||||
|
||||
if headers_paths.len() == 0 {
|
||||
@@ -318,12 +325,14 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
|
||||
bindings = bindings.clang_arg(format!("-I{}", include_path.display()));
|
||||
image_bindings = image_bindings.clang_arg(format!("-I{}", include_path.display()));
|
||||
ttf_bindings = ttf_bindings.clang_arg(format!("-I{}", include_path.display()));
|
||||
mixer_bindings = mixer_bindings.clang_arg(format!("-I{}", include_path.display()));
|
||||
} else {
|
||||
// if paths are included, use them for bindgen. Bindgen should use the first one.
|
||||
for headers_path in headers_paths {
|
||||
bindings = bindings.clang_arg(format!("-I{}", headers_path.as_ref()));
|
||||
image_bindings = image_bindings.clang_arg(format!("-I{}", headers_path.as_ref()));
|
||||
ttf_bindings = ttf_bindings.clang_arg(format!("-I{}", headers_path.as_ref()));
|
||||
mixer_bindings = mixer_bindings.clang_arg(format!("-I{}", headers_path.as_ref()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -345,6 +354,12 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
|
||||
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt"));
|
||||
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include"));
|
||||
ttf_bindings = ttf_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/8.1/Include/um"));
|
||||
|
||||
mixer_bindings = mixer_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/8.1/Include/shared"));
|
||||
mixer_bindings = mixer_bindings.clang_arg(format!("-IC:/Program Files/LLVM/lib/clang/5.0.0/include"));
|
||||
mixer_bindings = mixer_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.10240.0/ucrt"));
|
||||
mixer_bindings = mixer_bindings.clang_arg(format!("-IC:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include"));
|
||||
mixer_bindings = mixer_bindings.clang_arg(format!("-IC:/Program Files (x86)/Windows Kits/8.1/Include/um"));
|
||||
};
|
||||
|
||||
// SDL2 hasn't a default configuration for Linux
|
||||
@@ -355,6 +370,8 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
|
||||
image_bindings = image_bindings.clang_arg("-DSDL_VIDEO_DRIVER_WAYLAND");
|
||||
ttf_bindings = ttf_bindings.clang_arg("-DSDL_VIDEO_DRIVER_X11");
|
||||
ttf_bindings = ttf_bindings.clang_arg("-DSDL_VIDEO_DRIVER_WAYLAND");
|
||||
mixer_bindings = mixer_bindings.clang_arg("-DSDL_VIDEO_DRIVER_X11");
|
||||
mixer_bindings = mixer_bindings.clang_arg("-DSDL_VIDEO_DRIVER_WAYLAND");
|
||||
}
|
||||
|
||||
let bindings = bindings
|
||||
@@ -403,6 +420,24 @@ fn generate_bindings<S: AsRef<str> + ::std::fmt::Debug>(target: &str, host: &str
|
||||
.write_to_file(out_path.join("ttf_bindings.rs"))
|
||||
.expect("Couldn't write ttf_bindings!");
|
||||
|
||||
let mixer_bindings = mixer_bindings
|
||||
.header("wrapper_mixer.h")
|
||||
.whitelist_type("MIX.*")
|
||||
.whitelist_type("Mix.*")
|
||||
.whitelist_type("MUS.*")
|
||||
.whitelist_function("Mix.*")
|
||||
.whitelist_var("MIX.*")
|
||||
.whitelist_var("MUS.*")
|
||||
.blacklist_type("SDL_.*")
|
||||
.blacklist_type("_IO.*|FILE")
|
||||
.generate()
|
||||
.expect("Unable to generate mixer_bindings!");
|
||||
|
||||
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
||||
|
||||
mixer_bindings
|
||||
.write_to_file(out_path.join("mixer_bindings.rs"))
|
||||
.expect("Couldn't write mixer_bindings!");
|
||||
}
|
||||
|
||||
fn get_os_from_triple(triple: &str) -> Option<&str>
|
||||
|
||||
468
sdl2-sys/sdl_mixer_bindings.rs
Normal file
468
sdl2-sys/sdl_mixer_bindings.rs
Normal file
@@ -0,0 +1,468 @@
|
||||
/* automatically generated by rust-bindgen */
|
||||
|
||||
pub const MIX_MAJOR_VERSION: u32 = 2;
|
||||
pub const MIX_MINOR_VERSION: u32 = 0;
|
||||
pub const MIX_PATCHLEVEL: u32 = 2;
|
||||
pub const MIX_CHANNELS: u32 = 8;
|
||||
pub const MIX_DEFAULT_FREQUENCY: u32 = 22050;
|
||||
pub const MIX_DEFAULT_FORMAT: u32 = 32784;
|
||||
pub const MIX_DEFAULT_CHANNELS: u32 = 2;
|
||||
pub const MIX_MAX_VOLUME: u32 = 128;
|
||||
pub const MIX_CHANNEL_POST: i32 = -2;
|
||||
pub const MIX_EFFECTSMAXSPEED: &'static [u8; 20usize] = b"MIX_EFFECTSMAXSPEED\0";
|
||||
pub type __uint8_t = ::std::os::raw::c_uchar;
|
||||
pub type __int16_t = ::std::os::raw::c_short;
|
||||
pub type __uint16_t = ::std::os::raw::c_ushort;
|
||||
pub type __uint32_t = ::std::os::raw::c_uint;
|
||||
pub type __int64_t = ::std::os::raw::c_long;
|
||||
pub type __off_t = ::std::os::raw::c_long;
|
||||
pub type __off64_t = ::std::os::raw::c_long;
|
||||
pub type Uint8 = u8;
|
||||
pub type Sint16 = i16;
|
||||
pub type Uint16 = u16;
|
||||
pub type Uint32 = u32;
|
||||
pub type Sint64 = i64;
|
||||
extern "C" {
|
||||
pub fn Mix_Linked_Version() -> *const SDL_version;
|
||||
}
|
||||
pub const MIX_InitFlags_MIX_INIT_FLAC: MIX_InitFlags = 1;
|
||||
pub const MIX_InitFlags_MIX_INIT_MOD: MIX_InitFlags = 2;
|
||||
pub const MIX_InitFlags_MIX_INIT_MP3: MIX_InitFlags = 8;
|
||||
pub const MIX_InitFlags_MIX_INIT_OGG: MIX_InitFlags = 16;
|
||||
pub const MIX_InitFlags_MIX_INIT_MID: MIX_InitFlags = 32;
|
||||
pub type MIX_InitFlags = u32;
|
||||
extern "C" {
|
||||
pub fn Mix_Init(flags: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_Quit();
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct Mix_Chunk {
|
||||
pub allocated: ::std::os::raw::c_int,
|
||||
pub abuf: *mut Uint8,
|
||||
pub alen: Uint32,
|
||||
pub volume: Uint8,
|
||||
}
|
||||
#[test]
|
||||
fn bindgen_test_layout_Mix_Chunk() {
|
||||
assert_eq!(
|
||||
::std::mem::size_of::<Mix_Chunk>(),
|
||||
24usize,
|
||||
concat!("Size of: ", stringify!(Mix_Chunk))
|
||||
);
|
||||
assert_eq!(
|
||||
::std::mem::align_of::<Mix_Chunk>(),
|
||||
8usize,
|
||||
concat!("Alignment of ", stringify!(Mix_Chunk))
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<Mix_Chunk>())).allocated as *const _ as usize },
|
||||
0usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(Mix_Chunk),
|
||||
"::",
|
||||
stringify!(allocated)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<Mix_Chunk>())).abuf as *const _ as usize },
|
||||
8usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(Mix_Chunk),
|
||||
"::",
|
||||
stringify!(abuf)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<Mix_Chunk>())).alen as *const _ as usize },
|
||||
16usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(Mix_Chunk),
|
||||
"::",
|
||||
stringify!(alen)
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
unsafe { &(*(::std::ptr::null::<Mix_Chunk>())).volume as *const _ as usize },
|
||||
20usize,
|
||||
concat!(
|
||||
"Offset of field: ",
|
||||
stringify!(Mix_Chunk),
|
||||
"::",
|
||||
stringify!(volume)
|
||||
)
|
||||
);
|
||||
}
|
||||
pub const Mix_Fading_MIX_NO_FADING: Mix_Fading = 0;
|
||||
pub const Mix_Fading_MIX_FADING_OUT: Mix_Fading = 1;
|
||||
pub const Mix_Fading_MIX_FADING_IN: Mix_Fading = 2;
|
||||
pub type Mix_Fading = u32;
|
||||
pub const Mix_MusicType_MUS_NONE: Mix_MusicType = 0;
|
||||
pub const Mix_MusicType_MUS_CMD: Mix_MusicType = 1;
|
||||
pub const Mix_MusicType_MUS_WAV: Mix_MusicType = 2;
|
||||
pub const Mix_MusicType_MUS_MOD: Mix_MusicType = 3;
|
||||
pub const Mix_MusicType_MUS_MID: Mix_MusicType = 4;
|
||||
pub const Mix_MusicType_MUS_OGG: Mix_MusicType = 5;
|
||||
pub const Mix_MusicType_MUS_MP3: Mix_MusicType = 6;
|
||||
pub const Mix_MusicType_MUS_MP3_MAD_UNUSED: Mix_MusicType = 7;
|
||||
pub const Mix_MusicType_MUS_FLAC: Mix_MusicType = 8;
|
||||
pub const Mix_MusicType_MUS_MODPLUG_UNUSED: Mix_MusicType = 9;
|
||||
pub type Mix_MusicType = u32;
|
||||
#[repr(C)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub struct _Mix_Music {
|
||||
_unused: [u8; 0],
|
||||
}
|
||||
pub type Mix_Music = _Mix_Music;
|
||||
extern "C" {
|
||||
pub fn Mix_OpenAudio(
|
||||
frequency: ::std::os::raw::c_int,
|
||||
format: Uint16,
|
||||
channels: ::std::os::raw::c_int,
|
||||
chunksize: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_OpenAudioDevice(
|
||||
frequency: ::std::os::raw::c_int,
|
||||
format: Uint16,
|
||||
channels: ::std::os::raw::c_int,
|
||||
chunksize: ::std::os::raw::c_int,
|
||||
device: *const ::std::os::raw::c_char,
|
||||
allowed_changes: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_AllocateChannels(numchans: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_QuerySpec(
|
||||
frequency: *mut ::std::os::raw::c_int,
|
||||
format: *mut Uint16,
|
||||
channels: *mut ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_LoadWAV_RW(src: *mut SDL_RWops, freesrc: ::std::os::raw::c_int) -> *mut Mix_Chunk;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_LoadMUS(file: *const ::std::os::raw::c_char) -> *mut Mix_Music;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_LoadMUS_RW(src: *mut SDL_RWops, freesrc: ::std::os::raw::c_int) -> *mut Mix_Music;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_LoadMUSType_RW(
|
||||
src: *mut SDL_RWops,
|
||||
type_: Mix_MusicType,
|
||||
freesrc: ::std::os::raw::c_int,
|
||||
) -> *mut Mix_Music;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_QuickLoad_WAV(mem: *mut Uint8) -> *mut Mix_Chunk;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_QuickLoad_RAW(mem: *mut Uint8, len: Uint32) -> *mut Mix_Chunk;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FreeChunk(chunk: *mut Mix_Chunk);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FreeMusic(music: *mut Mix_Music);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetNumChunkDecoders() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetChunkDecoder(index: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_HasChunkDecoder(name: *const ::std::os::raw::c_char) -> SDL_bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetNumMusicDecoders() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetMusicDecoder(index: ::std::os::raw::c_int) -> *const ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_HasMusicDecoder(name: *const ::std::os::raw::c_char) -> SDL_bool;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetMusicType(music: *const Mix_Music) -> Mix_MusicType;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetPostMix(
|
||||
mix_func: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
udata: *mut ::std::os::raw::c_void,
|
||||
stream: *mut Uint8,
|
||||
len: ::std::os::raw::c_int,
|
||||
),
|
||||
>,
|
||||
arg: *mut ::std::os::raw::c_void,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_HookMusic(
|
||||
mix_func: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
udata: *mut ::std::os::raw::c_void,
|
||||
stream: *mut Uint8,
|
||||
len: ::std::os::raw::c_int,
|
||||
),
|
||||
>,
|
||||
arg: *mut ::std::os::raw::c_void,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_HookMusicFinished(music_finished: ::std::option::Option<unsafe extern "C" fn()>);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetMusicHookData() -> *mut ::std::os::raw::c_void;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_ChannelFinished(
|
||||
channel_finished: ::std::option::Option<
|
||||
unsafe extern "C" fn(channel: ::std::os::raw::c_int),
|
||||
>,
|
||||
);
|
||||
}
|
||||
pub type Mix_EffectFunc_t = ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
chan: ::std::os::raw::c_int,
|
||||
stream: *mut ::std::os::raw::c_void,
|
||||
len: ::std::os::raw::c_int,
|
||||
udata: *mut ::std::os::raw::c_void,
|
||||
),
|
||||
>;
|
||||
pub type Mix_EffectDone_t = ::std::option::Option<
|
||||
unsafe extern "C" fn(chan: ::std::os::raw::c_int, udata: *mut ::std::os::raw::c_void),
|
||||
>;
|
||||
extern "C" {
|
||||
pub fn Mix_RegisterEffect(
|
||||
chan: ::std::os::raw::c_int,
|
||||
f: Mix_EffectFunc_t,
|
||||
d: Mix_EffectDone_t,
|
||||
arg: *mut ::std::os::raw::c_void,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_UnregisterEffect(
|
||||
channel: ::std::os::raw::c_int,
|
||||
f: Mix_EffectFunc_t,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_UnregisterAllEffects(channel: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetPanning(
|
||||
channel: ::std::os::raw::c_int,
|
||||
left: Uint8,
|
||||
right: Uint8,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetPosition(
|
||||
channel: ::std::os::raw::c_int,
|
||||
angle: Sint16,
|
||||
distance: Uint8,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetDistance(
|
||||
channel: ::std::os::raw::c_int,
|
||||
distance: Uint8,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetReverseStereo(
|
||||
channel: ::std::os::raw::c_int,
|
||||
flip: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_ReserveChannels(num: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GroupChannel(
|
||||
which: ::std::os::raw::c_int,
|
||||
tag: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GroupChannels(
|
||||
from: ::std::os::raw::c_int,
|
||||
to: ::std::os::raw::c_int,
|
||||
tag: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GroupAvailable(tag: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GroupCount(tag: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GroupOldest(tag: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GroupNewer(tag: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_PlayChannelTimed(
|
||||
channel: ::std::os::raw::c_int,
|
||||
chunk: *mut Mix_Chunk,
|
||||
loops: ::std::os::raw::c_int,
|
||||
ticks: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_PlayMusic(
|
||||
music: *mut Mix_Music,
|
||||
loops: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadeInMusic(
|
||||
music: *mut Mix_Music,
|
||||
loops: ::std::os::raw::c_int,
|
||||
ms: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadeInMusicPos(
|
||||
music: *mut Mix_Music,
|
||||
loops: ::std::os::raw::c_int,
|
||||
ms: ::std::os::raw::c_int,
|
||||
position: f64,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadeInChannelTimed(
|
||||
channel: ::std::os::raw::c_int,
|
||||
chunk: *mut Mix_Chunk,
|
||||
loops: ::std::os::raw::c_int,
|
||||
ms: ::std::os::raw::c_int,
|
||||
ticks: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_Volume(
|
||||
channel: ::std::os::raw::c_int,
|
||||
volume: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_VolumeChunk(
|
||||
chunk: *mut Mix_Chunk,
|
||||
volume: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_VolumeMusic(volume: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_HaltChannel(channel: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_HaltGroup(tag: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_HaltMusic() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_ExpireChannel(
|
||||
channel: ::std::os::raw::c_int,
|
||||
ticks: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadeOutChannel(
|
||||
which: ::std::os::raw::c_int,
|
||||
ms: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadeOutGroup(
|
||||
tag: ::std::os::raw::c_int,
|
||||
ms: ::std::os::raw::c_int,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadeOutMusic(ms: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadingMusic() -> Mix_Fading;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_FadingChannel(which: ::std::os::raw::c_int) -> Mix_Fading;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_Pause(channel: ::std::os::raw::c_int);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_Resume(channel: ::std::os::raw::c_int);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_Paused(channel: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_PauseMusic();
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_ResumeMusic();
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_RewindMusic();
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_PausedMusic() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetMusicPosition(position: f64) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_Playing(channel: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_PlayingMusic() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetMusicCMD(command: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetSynchroValue(value: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetSynchroValue() -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_SetSoundFonts(paths: *const ::std::os::raw::c_char) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetSoundFonts() -> *const ::std::os::raw::c_char;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_EachSoundFont(
|
||||
function: ::std::option::Option<
|
||||
unsafe extern "C" fn(
|
||||
arg1: *const ::std::os::raw::c_char,
|
||||
arg2: *mut ::std::os::raw::c_void,
|
||||
) -> ::std::os::raw::c_int,
|
||||
>,
|
||||
data: *mut ::std::os::raw::c_void,
|
||||
) -> ::std::os::raw::c_int;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_GetChunk(channel: ::std::os::raw::c_int) -> *mut Mix_Chunk;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Mix_CloseAudio();
|
||||
}
|
||||
@@ -1,152 +1,2 @@
|
||||
use std::os::raw::{c_uint, c_int, c_char, c_double, c_void};
|
||||
|
||||
pub type MIX_InitFlags = c_uint;
|
||||
pub const MIX_INIT_FLAC: c_uint = 1;
|
||||
pub const MIX_INIT_MOD: c_uint = 2;
|
||||
pub const MIX_INIT_MODPLUG: c_uint = 4;
|
||||
pub const MIX_INIT_MP3: c_uint = 8;
|
||||
pub const MIX_INIT_OGG: c_uint = 16;
|
||||
pub const MIX_INIT_FLUIDSYNTH: c_uint = 32;
|
||||
#[repr(C)]
|
||||
pub struct Struct_Mix_Chunk {
|
||||
pub allocated: c_int,
|
||||
pub abuf: *const u8,
|
||||
pub alen: u32,
|
||||
pub volume: u8,
|
||||
}
|
||||
pub type Mix_Chunk = Struct_Mix_Chunk;
|
||||
pub type Mix_Fading = c_uint;
|
||||
pub const MIX_NO_FADING: c_uint = 0;
|
||||
pub const MIX_FADING_OUT: c_uint = 1;
|
||||
pub const MIX_FADING_IN: c_uint = 2;
|
||||
pub type Mix_MusicType = c_uint;
|
||||
pub const MUS_NONE: c_uint = 0;
|
||||
pub const MUS_CMD: c_uint = 1;
|
||||
pub const MUS_WAV: c_uint = 2;
|
||||
pub const MUS_MOD: c_uint = 3;
|
||||
pub const MUS_MID: c_uint = 4;
|
||||
pub const MUS_OGG: c_uint = 5;
|
||||
pub const MUS_MP3: c_uint = 6;
|
||||
pub const MUS_MP3_MAD: c_uint = 7;
|
||||
pub const MUS_FLAC: c_uint = 8;
|
||||
pub const MUS_MODPLUG: c_uint = 9;
|
||||
pub type Struct__Mix_Music = c_void;
|
||||
pub type Mix_Music = Struct__Mix_Music;
|
||||
pub type Mix_EffectFunc_t = ::std::option::Option<extern "C" fn(arg1: c_int,
|
||||
arg2: *const c_void,
|
||||
arg3: c_int,
|
||||
arg4: *const c_void)
|
||||
>;
|
||||
pub type Mix_EffectDone_t = ::std::option::Option<extern "C" fn(arg1: c_int,
|
||||
arg2: *const c_void)
|
||||
>;
|
||||
extern "C" {
|
||||
pub fn Mix_Linked_Version() -> *const ::SDL_version;
|
||||
pub fn Mix_Init(flags: c_int) -> c_int;
|
||||
pub fn Mix_Quit();
|
||||
pub fn Mix_OpenAudio(frequency: c_int,
|
||||
format: u16,
|
||||
channels: c_int,
|
||||
chunksize: c_int)
|
||||
-> c_int;
|
||||
pub fn Mix_AllocateChannels(numchans: c_int) -> c_int;
|
||||
pub fn Mix_QuerySpec(frequency: *mut c_int,
|
||||
format: *mut u16,
|
||||
channels: *mut c_int)
|
||||
-> c_int;
|
||||
pub fn Mix_LoadWAV_RW(src: *mut ::SDL_RWops, freesrc: c_int) -> *mut Mix_Chunk;
|
||||
pub fn Mix_LoadMUS(file: *const c_char) -> *mut Mix_Music;
|
||||
pub fn Mix_LoadMUS_RW(src: *mut ::SDL_RWops, freesrc: c_int) -> *mut Mix_Music;
|
||||
pub fn Mix_LoadMUSType_RW(src: *mut ::SDL_RWops,
|
||||
type_: Mix_MusicType,
|
||||
freesrc: c_int)
|
||||
-> *mut Mix_Music;
|
||||
pub fn Mix_QuickLoad_WAV(mem: *mut u8) -> *mut Mix_Chunk;
|
||||
pub fn Mix_QuickLoad_RAW(mem: *mut u8, len: u32) -> *mut Mix_Chunk;
|
||||
pub fn Mix_FreeChunk(chunk: *mut Mix_Chunk);
|
||||
pub fn Mix_FreeMusic(music: *mut Mix_Music);
|
||||
pub fn Mix_GetNumChunkDecoders() -> c_int;
|
||||
pub fn Mix_GetChunkDecoder(index: c_int) -> *const c_char;
|
||||
pub fn Mix_GetNumMusicDecoders() -> c_int;
|
||||
pub fn Mix_GetMusicDecoder(index: c_int) -> *const c_char;
|
||||
pub fn Mix_GetMusicType(music: *const Mix_Music) -> Mix_MusicType;
|
||||
pub fn Mix_SetPostMix(mix_func: Option<unsafe extern "C" fn(udata: *mut c_void,
|
||||
stream: *mut u8,
|
||||
len: c_int)>,
|
||||
arg: *mut c_void);
|
||||
pub fn Mix_HookMusic(mix_func: Option<unsafe extern "C" fn(udata: *mut c_void,
|
||||
stream: *mut u8,
|
||||
len: c_int)>,
|
||||
arg: *mut c_void);
|
||||
pub fn Mix_HookMusicFinished(music_finished: Option<extern "C" fn()>);
|
||||
pub fn Mix_GetMusicHookData() -> *mut c_void;
|
||||
pub fn Mix_ChannelFinished(channel_finished: Option<extern "C" fn(channel: c_int)>);
|
||||
pub fn Mix_RegisterEffect(chan: c_int,
|
||||
f: Mix_EffectFunc_t,
|
||||
d: Mix_EffectDone_t,
|
||||
arg: *mut c_void)
|
||||
-> c_int;
|
||||
pub fn Mix_UnregisterEffect(channel: c_int, f: Mix_EffectFunc_t) -> c_int;
|
||||
pub fn Mix_UnregisterAllEffects(channel: c_int) -> c_int;
|
||||
pub fn Mix_SetPanning(channel: c_int, left: u8, right: u8) -> c_int;
|
||||
pub fn Mix_SetPosition(channel: c_int, angle: i16, distance: u8) -> c_int;
|
||||
pub fn Mix_SetDistance(channel: c_int, distance: u8) -> c_int;
|
||||
pub fn Mix_SetReverseStereo(channel: c_int, flip: c_int) -> c_int;
|
||||
pub fn Mix_ReserveChannels(num: c_int) -> c_int;
|
||||
pub fn Mix_GroupChannel(which: c_int, tag: c_int) -> c_int;
|
||||
pub fn Mix_GroupChannels(from: c_int, to: c_int, tag: c_int) -> c_int;
|
||||
pub fn Mix_GroupAvailable(tag: c_int) -> c_int;
|
||||
pub fn Mix_GroupCount(tag: c_int) -> c_int;
|
||||
pub fn Mix_GroupOldest(tag: c_int) -> c_int;
|
||||
pub fn Mix_GroupNewer(tag: c_int) -> c_int;
|
||||
pub fn Mix_PlayChannelTimed(channel: c_int,
|
||||
chunk: *mut Mix_Chunk,
|
||||
loops: c_int,
|
||||
ticks: c_int)
|
||||
-> c_int;
|
||||
pub fn Mix_PlayMusic(music: *mut Mix_Music, loops: c_int) -> c_int;
|
||||
pub fn Mix_FadeInMusic(music: *mut Mix_Music, loops: c_int, ms: c_int) -> c_int;
|
||||
pub fn Mix_FadeInMusicPos(music: *mut Mix_Music,
|
||||
loops: c_int,
|
||||
ms: c_int,
|
||||
position: c_double)
|
||||
-> c_int;
|
||||
pub fn Mix_FadeInChannelTimed(channel: c_int,
|
||||
chunk: *mut Mix_Chunk,
|
||||
loops: c_int,
|
||||
ms: c_int,
|
||||
ticks: c_int)
|
||||
-> c_int;
|
||||
pub fn Mix_Volume(channel: c_int, volume: c_int) -> c_int;
|
||||
pub fn Mix_VolumeChunk(chunk: *mut Mix_Chunk, volume: c_int) -> c_int;
|
||||
pub fn Mix_VolumeMusic(volume: c_int) -> c_int;
|
||||
pub fn Mix_HaltChannel(channel: c_int) -> c_int;
|
||||
pub fn Mix_HaltGroup(tag: c_int) -> c_int;
|
||||
pub fn Mix_HaltMusic() -> c_int;
|
||||
pub fn Mix_ExpireChannel(channel: c_int, ticks: c_int) -> c_int;
|
||||
pub fn Mix_FadeOutChannel(which: c_int, ms: c_int) -> c_int;
|
||||
pub fn Mix_FadeOutGroup(tag: c_int, ms: c_int) -> c_int;
|
||||
pub fn Mix_FadeOutMusic(ms: c_int) -> c_int;
|
||||
pub fn Mix_FadingMusic() -> Mix_Fading;
|
||||
pub fn Mix_FadingChannel(which: c_int) -> Mix_Fading;
|
||||
pub fn Mix_Pause(channel: c_int);
|
||||
pub fn Mix_Resume(channel: c_int);
|
||||
pub fn Mix_Paused(channel: c_int) -> c_int;
|
||||
pub fn Mix_PauseMusic();
|
||||
pub fn Mix_ResumeMusic();
|
||||
pub fn Mix_RewindMusic();
|
||||
pub fn Mix_PausedMusic() -> c_int;
|
||||
pub fn Mix_SetMusicPosition(position: c_double) -> c_int;
|
||||
pub fn Mix_Playing(channel: c_int) -> c_int;
|
||||
pub fn Mix_PlayingMusic() -> c_int;
|
||||
pub fn Mix_SetMusicCMD(command: *const c_char) -> c_int;
|
||||
pub fn Mix_SetSynchroValue(value: c_int) -> c_int;
|
||||
pub fn Mix_GetSynchroValue() -> c_int;
|
||||
pub fn Mix_SetSoundFonts(paths: *const c_char) -> c_int;
|
||||
pub fn Mix_GetSoundFonts() -> *const c_char;
|
||||
pub fn Mix_EachSoundFont(function: Option<unsafe extern "C" fn(arg1: *const c_char,
|
||||
arg2: *mut c_void) -> c_int>,
|
||||
data: *mut c_void) -> c_int;
|
||||
pub fn Mix_GetChunk(channel: c_int) -> *mut Mix_Chunk;
|
||||
pub fn Mix_CloseAudio();
|
||||
}
|
||||
use ::*;
|
||||
include!(concat!(env!("OUT_DIR"), "/mixer_bindings.rs"));
|
||||
|
||||
1
sdl2-sys/wrapper_mixer.h
Normal file
1
sdl2-sys/wrapper_mixer.h
Normal file
@@ -0,0 +1 @@
|
||||
#include <SDL2/SDL_mixer.h>
|
||||
@@ -96,12 +96,11 @@ pub fn get_linked_version() -> Version {
|
||||
}
|
||||
|
||||
bitflags!(pub flags InitFlag : u32 {
|
||||
const INIT_FLAC = sys::mixer::MIX_INIT_FLAC as u32,
|
||||
const INIT_MOD = sys::mixer::MIX_INIT_MOD as u32,
|
||||
const INIT_MODPLUG = sys::mixer::MIX_INIT_MODPLUG as u32,
|
||||
const INIT_MP3 = sys::mixer::MIX_INIT_MP3 as u32,
|
||||
const INIT_OGG = sys::mixer::MIX_INIT_OGG as u32,
|
||||
const INIT_FLUIDSYNTH = sys::mixer::MIX_INIT_FLUIDSYNTH as u32
|
||||
const INIT_FLAC = sys::mixer::MIX_InitFlags_MIX_INIT_FLAC as u32,
|
||||
const INIT_MOD = sys::mixer::MIX_InitFlags_MIX_INIT_MOD as u32,
|
||||
const INIT_MP3 = sys::mixer::MIX_InitFlags_MIX_INIT_MP3 as u32,
|
||||
const INIT_OGG = sys::mixer::MIX_InitFlags_MIX_INIT_OGG as u32,
|
||||
const INIT_MID = sys::mixer::MIX_InitFlags_MIX_INIT_MID as u32
|
||||
});
|
||||
|
||||
impl ToString for InitFlag {
|
||||
@@ -113,17 +112,14 @@ impl ToString for InitFlag {
|
||||
if self.contains(INIT_MOD) {
|
||||
string = string + &"INIT_MOD ".to_string();
|
||||
}
|
||||
if self.contains(INIT_MODPLUG) {
|
||||
string = string + &"INIT_MODPLUG ".to_string();
|
||||
}
|
||||
if self.contains(INIT_MP3) {
|
||||
string = string + &"INIT_MP3 ".to_string();
|
||||
}
|
||||
if self.contains(INIT_OGG) {
|
||||
string = string + &"INIT_OGG ".to_string();
|
||||
}
|
||||
if self.contains(INIT_FLUIDSYNTH) {
|
||||
string = string + &"INIT_FLUIDSYNTH ".to_string();
|
||||
if self.contains(INIT_MID) {
|
||||
string = string + &"INIT_MID ".to_string();
|
||||
}
|
||||
string
|
||||
}
|
||||
@@ -307,9 +303,9 @@ impl<'a> LoaderRWops<'a> for RWops<'a> {
|
||||
#[repr(i32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Hash)]
|
||||
pub enum Fading {
|
||||
NoFading = sys::mixer::MIX_NO_FADING as i32,
|
||||
FadingOut = sys::mixer::MIX_FADING_OUT as i32,
|
||||
FadingIn = sys::mixer::MIX_FADING_IN as i32,
|
||||
NoFading = sys::mixer::Mix_Fading_MIX_NO_FADING as i32,
|
||||
FadingOut = sys::mixer::Mix_Fading_MIX_FADING_OUT as i32,
|
||||
FadingIn = sys::mixer::Mix_Fading_MIX_FADING_IN as i32,
|
||||
}
|
||||
|
||||
/// Sound effect channel.
|
||||
@@ -474,9 +470,9 @@ impl Channel {
|
||||
let Channel(ch) = self;
|
||||
let ret = unsafe { sys::mixer::Mix_FadingChannel(ch as c_int) as c_uint };
|
||||
match ret {
|
||||
sys::mixer::MIX_FADING_OUT => Fading::FadingOut,
|
||||
sys::mixer::MIX_FADING_IN => Fading::FadingIn,
|
||||
sys::mixer::MIX_NO_FADING | _ => Fading::NoFading
|
||||
sys::mixer::Mix_Fading_MIX_FADING_OUT => Fading::FadingOut,
|
||||
sys::mixer::Mix_Fading_MIX_FADING_IN => Fading::FadingIn,
|
||||
sys::mixer::Mix_Fading_MIX_NO_FADING | _ => Fading::NoFading
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,16 +700,16 @@ pub fn get_music_decoder(index: i32) -> String {
|
||||
#[repr(i32)]
|
||||
#[derive(Copy, Clone, PartialEq, Hash, Debug)]
|
||||
pub enum MusicType {
|
||||
MusicNone = sys::mixer::MUS_NONE as i32,
|
||||
MusicCmd = sys::mixer::MUS_CMD as i32,
|
||||
MusicWav = sys::mixer::MUS_WAV as i32,
|
||||
MusicMod = sys::mixer::MUS_MOD as i32,
|
||||
MusicMid = sys::mixer::MUS_MID as i32,
|
||||
MusicOgg = sys::mixer::MUS_OGG as i32,
|
||||
MusicMp3 = sys::mixer::MUS_MP3 as i32,
|
||||
MusicMp3Mad = sys::mixer::MUS_MP3_MAD as i32,
|
||||
MusicFlac = sys::mixer::MUS_FLAC as i32,
|
||||
MusicModPlug = sys::mixer::MUS_MODPLUG as i32,
|
||||
MusicNone = sys::mixer::Mix_MusicType_MUS_NONE as i32,
|
||||
MusicCmd = sys::mixer::Mix_MusicType_MUS_CMD as i32,
|
||||
MusicWav = sys::mixer::Mix_MusicType_MUS_WAV as i32,
|
||||
MusicMod = sys::mixer::Mix_MusicType_MUS_MOD as i32,
|
||||
MusicMid = sys::mixer::Mix_MusicType_MUS_MID as i32,
|
||||
MusicOgg = sys::mixer::Mix_MusicType_MUS_OGG as i32,
|
||||
MusicMp3 = sys::mixer::Mix_MusicType_MUS_MP3 as i32,
|
||||
MusicMp3Mad = sys::mixer::Mix_MusicType_MUS_MP3_MAD_UNUSED as i32,
|
||||
MusicFlac = sys::mixer::Mix_MusicType_MUS_FLAC as i32,
|
||||
MusicModPlug = sys::mixer::Mix_MusicType_MUS_MODPLUG_UNUSED as i32,
|
||||
}
|
||||
|
||||
// hooks
|
||||
@@ -795,16 +791,16 @@ impl<'a> Music<'a> {
|
||||
pub fn get_type(&self) -> MusicType {
|
||||
let ret = unsafe { sys::mixer::Mix_GetMusicType(self.raw) as i32 } as c_uint;
|
||||
match ret {
|
||||
sys::mixer::MUS_CMD => MusicType::MusicCmd,
|
||||
sys::mixer::MUS_WAV => MusicType::MusicWav,
|
||||
sys::mixer::MUS_MOD => MusicType::MusicMod,
|
||||
sys::mixer::MUS_MID => MusicType::MusicMid,
|
||||
sys::mixer::MUS_OGG => MusicType::MusicOgg,
|
||||
sys::mixer::MUS_MP3 => MusicType::MusicMp3,
|
||||
sys::mixer::MUS_MP3_MAD => MusicType::MusicMp3Mad,
|
||||
sys::mixer::MUS_FLAC => MusicType::MusicFlac,
|
||||
sys::mixer::MUS_MODPLUG => MusicType::MusicModPlug,
|
||||
sys::mixer::MUS_NONE | _ => MusicType::MusicNone
|
||||
sys::mixer::Mix_MusicType_MUS_CMD => MusicType::MusicCmd,
|
||||
sys::mixer::Mix_MusicType_MUS_WAV => MusicType::MusicWav,
|
||||
sys::mixer::Mix_MusicType_MUS_MOD => MusicType::MusicMod,
|
||||
sys::mixer::Mix_MusicType_MUS_MID => MusicType::MusicMid,
|
||||
sys::mixer::Mix_MusicType_MUS_OGG => MusicType::MusicOgg,
|
||||
sys::mixer::Mix_MusicType_MUS_MP3 => MusicType::MusicMp3,
|
||||
sys::mixer::Mix_MusicType_MUS_MP3_MAD_UNUSED => MusicType::MusicMp3Mad,
|
||||
sys::mixer::Mix_MusicType_MUS_FLAC => MusicType::MusicFlac,
|
||||
sys::mixer::Mix_MusicType_MUS_MODPLUG_UNUSED => MusicType::MusicModPlug,
|
||||
sys::mixer::Mix_MusicType_MUS_NONE | _ => MusicType::MusicNone
|
||||
}
|
||||
}
|
||||
|
||||
@@ -959,9 +955,9 @@ impl<'a> Music<'a> {
|
||||
pub fn get_fading() -> Fading {
|
||||
let ret = unsafe { sys::mixer::Mix_FadingMusic() as i32 } as c_uint;
|
||||
match ret {
|
||||
sys::mixer::MIX_FADING_OUT => Fading::FadingOut,
|
||||
sys::mixer::MIX_FADING_IN => Fading::FadingIn,
|
||||
sys::mixer::MIX_NO_FADING | _ => Fading::NoFading
|
||||
sys::mixer::Mix_Fading_MIX_FADING_OUT => Fading::FadingOut,
|
||||
sys::mixer::Mix_Fading_MIX_FADING_IN => Fading::FadingIn,
|
||||
sys::mixer::Mix_Fading_MIX_NO_FADING | _ => Fading::NoFading
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user