1#![feature(decl_macro)]
4
5#[macro_use] extern crate bitflags;
6
7pub use num_traits::FromPrimitive;
8
9pub use fmod_sys as ll;
10
11#[cfg(target_os = "linux")]
12#[link(name = "fmod")] unsafe extern "C" {}
13
14#[cfg(target_os = "windows")]
15#[link(name = "fmod64_vc")] unsafe extern "C" {}
16
17pub mod channel;
22pub mod channel_control;
23pub mod channel_group;
24pub mod dsp;
25pub mod reverb3d;
26pub mod sound;
27pub mod sound_group;
28pub mod system;
29
30pub use self::channel::Channel;
31pub use self::channel_control::ChannelControl;
32pub use self::channel_group::{ChannelGroup, ChannelGroupRef};
33pub use self::dsp::{Dsp, DspRef};
34pub use self::reverb3d::Reverb3d;
35pub use self::sound::{Sound, SoundRef};
36pub use self::sound_group::SoundGroup;
37pub use self::system::System;
38mod types;
40pub use self::types::{Channelmask, CpuUsage, Delay, DebugFlags, DriverState,
41 Error, Guid, ListenerAttributes, Mode, PluginHandle, Plugintype, SoundRam,
42 Speaker, Speakermode, Timeunit};
43
44pub const FMOD_VERSION : u32 = ll::FMOD_VERSION;
50pub const CODEC_WAVEFORMAT_VERSION : u32 = ll::FMOD_CODEC_WAVEFORMAT_VERSION;
51pub const MAX_CHANNEL_WIDTH : u32 = ll::FMOD_MAX_CHANNEL_WIDTH;
52pub const MAX_SYSTEMS : u32 = ll::FMOD_MAX_SYSTEMS;
53pub const MAX_LISTENERS : u32 = ll::FMOD_MAX_LISTENERS;
54pub const OUTPUT_PLUGIN_VERSION : u32 = ll::FMOD_OUTPUT_PLUGIN_VERSION;
55pub const PLUGIN_SDK_VERSION : u32 = ll::FMOD_PLUGIN_SDK_VERSION;
56pub static FMOD_VERSION_STRING : std::sync::LazyLock <String> =
58 std::sync::LazyLock::new (|| version_string (FMOD_VERSION));
59
60pub (crate) macro fmod_result {
61 ($e:expr) => {{
62 match $e {
63 $crate::ll::FMOD_RESULT_FMOD_OK => Ok (()),
64 err => Err ($crate::Error::from_ll (err))
65 }
66 }}
67}
68
69pub mod vector {
70 use crate::ll;
71 pub const fn from_ll (vector : ll::FMOD_VECTOR) -> [f32; 3] {
72 [vector.x, vector.y, vector.z]
73 }
74 pub const fn to_ll (vector : [f32; 3]) -> ll::FMOD_VECTOR {
75 ll::FMOD_VECTOR { x: vector[0], y: vector[1], z: vector[2] }
76 }
77}
78
79pub (crate) fn version_string (fmod_version : u32) -> String {
80 format!("{:x}.{:x}.{:x}",
81 (fmod_version & 0xffff_0000) >> 16,
82 (fmod_version & 0x0000_ff00) >> 8,
83 (fmod_version & 0x0000_00ff))
84}