mirror of
https://github.com/encounter/rust-sdl2.git
synced 2026-07-10 21:18:41 -07:00
Add 'src/sdl2/mixer/' from commit '317d9e1e759f3b7c82aa348e693065efa2ab6fea'
git-subtree-dir: src/sdl2/mixer git-subtree-mainline:7594231a4fgit-subtree-split:317d9e1e75
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
*~
|
||||
*#
|
||||
*.o
|
||||
*.so
|
||||
*.swp
|
||||
*.dylib
|
||||
*.dSYM
|
||||
*.dll
|
||||
*.rlib
|
||||
*.dummy
|
||||
*.exe
|
||||
*-test
|
||||
/bin/main
|
||||
/bin/test-internal
|
||||
/bin/test-external
|
||||
/doc/
|
||||
/target/
|
||||
/build/
|
||||
/.rust/
|
||||
rusti.sh
|
||||
|
||||
Cargo.lock
|
||||
@@ -0,0 +1,28 @@
|
||||
language: rust
|
||||
rust:
|
||||
- beta
|
||||
- stable
|
||||
env:
|
||||
global:
|
||||
- secure: JLix99cbDVr9+s9QOux8FmnyEHGmpNHavKoO7lo1dG4Em8XyeByIXeBNggYX3d/vpdQ+FrqNO+3HrRJpZvXl1OO3uPGFtIQLH6bXLTaggC3z/67maEQSQQS8rcSHImkg1CDKoPWKvZfnB6IqWRYLTBJWILwBLoocure7/+/8III=
|
||||
- LD_LIBRARY_PATH: /usr/local/lib
|
||||
install:
|
||||
- cd ..
|
||||
- time wget -q https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
|
||||
- time wget -q https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-2.0.0.tar.gz
|
||||
- time tar xf SDL2-*.tar.gz
|
||||
- time tar xf SDL2_mixer-*.tar.gz
|
||||
- cd SDL2-*
|
||||
- ./configure && make && sudo make install
|
||||
- cd -
|
||||
- cd SDL2_mixer-*
|
||||
- ./configure && make && sudo make install
|
||||
- cd -
|
||||
- cd rust-sdl2_mixer
|
||||
script:
|
||||
- cargo build -v
|
||||
- cargo test -v
|
||||
- cargo doc -v
|
||||
after_script:
|
||||
- cp -R target/doc doc
|
||||
- curl https://www.rust-ci.org/artifacts/put?t=$RUSTCI_TOKEN | sh
|
||||
@@ -0,0 +1,24 @@
|
||||
[package]
|
||||
name = "sdl2_mixer"
|
||||
description = "SDL2_mixer bindings for Rust"
|
||||
repository = "https://github.com/andelf/rust-sdl2_mixer"
|
||||
version = "0.25.0"
|
||||
license = "MIT/Apache-2.0"
|
||||
authors = ["ShuYu Wang <andelf@gmail.com>"]
|
||||
keywords = ["SDL", "windowing", "graphics", "music", "sound"]
|
||||
|
||||
[lib]
|
||||
name = "sdl2_mixer"
|
||||
path = "src/sdl2_mixer/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "0.6.0"
|
||||
sdl2 = "0.25.0"
|
||||
sdl2-sys = "0.25.0"
|
||||
libc = "0.2"
|
||||
|
||||
# [dependencies.sdl2]
|
||||
# git = "https://github.com/AngryLawyer/rust-sdl2"
|
||||
|
||||
# [dependencies.sdl2-sys]
|
||||
# git = "https://github.com/AngryLawyer/rust-sdl2"
|
||||
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,25 @@
|
||||
Copyright (c) 2010 The Rust Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,105 @@
|
||||
Rust-SDL2_mixer
|
||||
=============
|
||||
|
||||
[](https://travis-ci.org/andelf/rust-sdl2_mixer)
|
||||
[](https://crates.io/crates/sdl2_mixer)
|
||||
[](https://github.com/andelf/rust-sdl2_mixer/blob/master/LICENSE-MIT)
|
||||
|
||||
Rust bindings for SDL2_mixer.
|
||||
|
||||
## Overview
|
||||
|
||||
Rust-SDL2_mixer is a library for talking to the new SDL2_mixer library from Rust.
|
||||
|
||||
Rust-SDL2_mixer uses the MIT licence.
|
||||
|
||||
## Requirements
|
||||
|
||||
* [Rust-SDL2](https://github.com/AngryLawyer/rust-sdl2)
|
||||
* SDL2_mixer development libraries
|
||||
* Latest stable Rust master
|
||||
|
||||
#### OSX
|
||||
|
||||
```bash
|
||||
brew install sdl2_mixer --with-flac --with-fluid-synth --with-libmikmod --with-libmodplug --with-libvorbis --with-smpeg2
|
||||
```
|
||||
|
||||
#### Windows
|
||||
|
||||
1. Download mingw development libraries from https://www.libsdl.org/projects/SDL_mixer/
|
||||
(`SDL2_mixer-devel-2.0.x-mingw.tar.gz`)
|
||||
2. Unpack to a folder of your choosing (You can delete it afterwards).
|
||||
3. Copy all lib files from
|
||||
> SDL2_mixer-2.0.x\x86_64-w64-mingw32\lib\
|
||||
|
||||
to (for Rust 1.6 and above)
|
||||
> C:\Program Files\Rust\\**lib**\rustlib\x86_64-pc-windows-gnu\lib
|
||||
|
||||
or to (for Rust versions 1.5 and below)
|
||||
> C:\Program Files\Rust\\**bin**\rustlib\x86_64-pc-windows-gnu\lib
|
||||
|
||||
or to your library folder of choice, and ensure you have a system environment variable of
|
||||
> LIBRARY_PATH = C:\your\rust\library\folder
|
||||
|
||||
For Multirust Users, this folder will be in
|
||||
> C:\Users\{Your Username}\AppData\Local\.multirust\toolchains\{current toolchain}\lib\rustlib\x86_64-pc-windows-gnu\lib
|
||||
4. Copy `SDL2_mixer.dll` and `smpeg2.dll` from
|
||||
> SDL2_mixer-2.0.x\x86_64-w64-mingw32\bin\
|
||||
|
||||
into your cargo project, right next to your `Cargo.toml`.
|
||||
|
||||
## Installation
|
||||
|
||||
Place the following into your project's Cargo.toml file:
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
sdl2_mixer = "0.24.0"
|
||||
```
|
||||
|
||||
Or, to depend on the newest rust-sdl2_mixer, reference the repository:
|
||||
|
||||
```toml
|
||||
[dependencies.sdl2_mixer]
|
||||
git = "https://github.com/andelf/rust-sdl2_mixer"
|
||||
```
|
||||
|
||||
You can also just clone and build the library yourself:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/andelf/rust-sdl2_mixer
|
||||
cd rust-sdl2_mixer
|
||||
cargo build
|
||||
# TODO: OR if you are using the mac framework version
|
||||
rustc --cfg mac_framework src/sdl2_mixer/lib.rs
|
||||
```
|
||||
|
||||
If you're not using Cargo, you can compile the library manually:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/andelf/rust-sdl2_mixer
|
||||
cd rust-sdl2_mixer
|
||||
rustc src/sdl2_mixer/lib.rs
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
||||
A simple demo that plays out a portion of a given music file is included:
|
||||
|
||||
```bash
|
||||
cargo run --example demo path/to/music.(mp3|flac|ogg|wav)
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Licensed under either of
|
||||
* Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
||||
* MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
||||
at your option.
|
||||
|
||||
### Contribution
|
||||
|
||||
Unless you explicitly state otherwise, any contribution intentionally submitted
|
||||
for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any
|
||||
additional terms or conditions.
|
||||
@@ -0,0 +1,86 @@
|
||||
extern crate sdl2;
|
||||
extern crate sdl2_mixer;
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
use sdl2_mixer::{INIT_MP3, INIT_FLAC, INIT_MOD, INIT_FLUIDSYNTH, INIT_MODPLUG, INIT_OGG,
|
||||
AUDIO_S16LSB};
|
||||
|
||||
fn main() {
|
||||
|
||||
let args: Vec<_> = env::args().collect();
|
||||
|
||||
if args.len() < 2 {
|
||||
println!("Usage: ./demo audio.[mp3|wav|ogg]")
|
||||
} else {
|
||||
demo(Path::new(&args[1]));
|
||||
}
|
||||
}
|
||||
|
||||
fn demo(filename: &Path) {
|
||||
|
||||
println!("linked version: {}", sdl2_mixer::get_linked_version());
|
||||
|
||||
let sdl = sdl2::init().unwrap();
|
||||
let _audio = sdl.audio().unwrap();
|
||||
let mut timer = sdl.timer().unwrap();
|
||||
let _mixer_context = sdl2_mixer::init(INIT_MP3 | INIT_FLAC | INIT_MOD | INIT_FLUIDSYNTH |
|
||||
INIT_MODPLUG |
|
||||
INIT_OGG)
|
||||
.unwrap();
|
||||
|
||||
let frequency = 44100;
|
||||
let format = AUDIO_S16LSB; // signed 16 bit samples, in little-endian byte order
|
||||
let channels = 2; // Stereo
|
||||
let chunk_size = 1024;
|
||||
let _ = sdl2_mixer::open_audio(frequency, format, channels, chunk_size).unwrap();
|
||||
sdl2_mixer::allocate_channels(0);
|
||||
|
||||
{
|
||||
let n = sdl2_mixer::get_chunk_decoders_number();
|
||||
println!("available chunk(sample) decoders: {}", n);
|
||||
for i in 0..n {
|
||||
println!(" decoder {} => {}", i, sdl2_mixer::get_chunk_decoder(i));
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
let n = sdl2_mixer::get_music_decoders_number();
|
||||
println!("available music decoders: {}", n);
|
||||
for i in 0..n {
|
||||
println!(" decoder {} => {}", i, sdl2_mixer::get_music_decoder(i));
|
||||
}
|
||||
}
|
||||
|
||||
println!("query spec => {:?}", sdl2_mixer::query_spec());
|
||||
|
||||
|
||||
let music = sdl2_mixer::Music::from_file(filename).unwrap();
|
||||
|
||||
fn hook_finished() {
|
||||
println!("play ends! from rust cb");
|
||||
}
|
||||
|
||||
sdl2_mixer::Music::hook_finished(hook_finished);
|
||||
|
||||
println!("music => {:?}", music);
|
||||
println!("music type => {:?}", music.get_type());
|
||||
println!("music volume => {:?}", sdl2_mixer::Music::get_volume());
|
||||
println!("play => {:?}", music.play(1));
|
||||
|
||||
timer.delay(10000);
|
||||
|
||||
println!("fading out ... {:?}", sdl2_mixer::Music::fade_out(4000));
|
||||
|
||||
timer.delay(5000);
|
||||
|
||||
println!("fading in from pos ... {:?}",
|
||||
music.fade_in_from_pos(1, 10000, 100.0));
|
||||
|
||||
timer.delay(5000);
|
||||
sdl2_mixer::Music::halt();
|
||||
timer.delay(1000);
|
||||
|
||||
|
||||
println!("quitting sdl");
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
extern crate sdl2_sys as sys;
|
||||
|
||||
use std::os::raw::{c_uint, c_int, c_char, c_double, c_void};
|
||||
use self::sys::rwops::SDL_RWops;
|
||||
use self::sys::version::SDL_version;
|
||||
|
||||
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();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user