rfmod/
rfmod.rs

1/*
2* Rust-FMOD - Copyright (c) 2016 Gomez Guillaume.
3*
4* The Original software, FmodEx library, is provided by FIRELIGHT TECHNOLOGIES.
5*
6* This software is provided 'as-is', without any express or implied warranty.
7* In no event will the authors be held liable for any damages arising from
8* the use of this software.
9*
10* Permission is granted to anyone to use this software for any purpose,
11* including commercial applications, and to alter it and redistribute it
12* freely, subject to the following restrictions:
13*
14* 1. The origin of this software must not be misrepresented; you must not claim
15*    that you wrote the original software. If you use this software in a product,
16*    an acknowledgment in the product documentation would be appreciated but is
17*    not required.
18*
19* 2. Altered source versions must be plainly marked as such, and must not be
20*    misrepresented as being the original software.
21*
22* 3. This notice may not be removed or altered from any source distribution.
23*/
24
25/*!
26# rust-fmod
27
28This is a rust binding for __FMOD__, the library developped by FIRELIGHT TECHNOLOGIES.
29
30__FMOD__ website: <www.fmod.org>
31
32## Installation
33
34You must install on your computer the __FMOD__ library which is used for the binding.
35
36## Short example
37
38Here is a short example on how to create a file and to play it:
39
40```Rust
41extern crate libc;
42extern crate rfmod;
43
44use std::os;
45
46fn main() {
47    let fmod = match rfmod::Sys::new() {
48        Ok(f) => f,
49        Err(e) => {
50            panic!("Error code : {}", e);
51        }
52    };
53
54    match fmod.init() {
55        rfmod::Status::Ok => {}
56        e => {
57            panic!("Sys.init failed : {}", e);
58        }
59    };
60
61    let mut sound = match fmod.create_sound(StrBuf::from_str("music.mp3"), None, None) {
62        Ok(s) => s,
63        Err(err) => {
64            panic!("Error code : {}", err);
65        }
66    };
67
68    match sound.play_to_the_end() {
69        rfmod::Status::Ok => {
70            println!("Ok !");
71        }
72        err => {
73            panic!("Error code : {}", err);
74        }
75    };
76}
77```
78
79For a more complete example: https://github.com/GuillaumeGomez/rust-music-player
80
81## License
82
83```text
84Copyright (c) 2014 Guillaume Gomez
85
86The license of this project is available in the LICENSE.TXT file. Please refer to it.
87If you want more information, here is the website for FMOD : http://www.fmod.org/
88```
89
90### Notes
91
92 * Members marked with [r] mean the variable is modified by FMOD and is for reading purposes only. Do not change this value.
93 * Members marked with [w] mean the variable can be written to. The user can set the value.
94
95
96Here is the list of all modules :
97!*/
98
99#![crate_name = "rfmod"]
100#![crate_type = "rlib"]
101#![crate_type = "dylib"]
102
103#![allow(non_camel_case_types)]
104#![allow(non_snake_case)]
105#![allow(dead_code)]
106#![allow(improper_ctypes)]
107
108extern crate libc;
109extern crate c_vec;
110extern crate byteorder;
111
112pub use channel::{
113    Channel,
114    SpeakerMixOptions,
115    ReverbChannelProperties
116};
117pub use fmod_sys::{
118    Sys,
119    Guid,
120    SoftwareFormat,
121    AdvancedSettings,
122    OutputHandle,
123    CreateSoundexInfo,
124    MemoryUsageDetails,
125    UserData
126};
127pub use sound::{
128    Sound,
129    FmodTag,
130    FmodSyncPoint
131};
132pub use channel_group::{
133    ChannelGroup
134};
135pub use sound_group::SoundGroup;
136pub use dsp::{
137    Dsp,
138    DspParameterDesc,
139    DspDescription,
140    DspState
141};
142pub use dsp_connection::DspConnection;
143pub use reverb::Reverb;
144pub use reverb_properties::ReverbProperties;
145pub use vector::Vector;
146pub use geometry::Geometry;
147pub use file::{
148    FmodFile,
149    SeekStyle
150};
151pub use self::enums::{
152    Status,
153    RStatus,
154    SpeakerMapType,
155    SoundFormat,
156    SoundType,
157    TagType,
158    TagDataType,
159    ChannelIndex,
160    DspFftWindow,
161    DelayType,
162    OutputType,
163    Speaker,
164    SpeakerMode,
165    DspResampler,
166    PluginType,
167    OpenState,
168    SystemCallbackType,
169    SoundGroupBehavior,
170    DspType,
171    DspOscillator,
172    DspLowPass,
173    DspITLowPass,
174    DspHighPass,
175    DspTypeEcho,
176    DspDelay,
177    DspFlange,
178    DspTremolo,
179    DspDistortion,
180    DspNormalize,
181    DspTypeParameq,
182    DspPitchShift,
183    DspChorus,
184    DspITEcho,
185    DspCompressor,
186    DspSfxReverb,
187    DspLowPassSimple,
188    DspHighPassSimple
189};
190pub use self::types::{
191    Mode,
192    TimeUnit,
193    FmodCaps,
194    PluginHandle,
195    InitFlag,
196    MemoryBits,
197    EventMemoryBits,
198};
199
200#[macro_use]
201mod utils;
202
203mod ffi;
204mod sound;
205mod channel;
206mod channel_group;
207mod sound_group;
208mod fmod_sys;
209mod dsp;
210mod dsp_connection;
211mod geometry;
212mod vector;
213mod reverb;
214mod reverb_properties;
215mod file;
216mod enums;
217pub mod types;
218pub mod callbacks;
219pub mod error;
220
221/// Default for all modes listed below. LOOP_OFF, 2D, HARDWARE
222pub const DEFAULT                : u32 = 0x00000000;
223/// For non looping sounds. (DEFAULT). Overrides LOOP_NORMAL / LOOP_BIDI.
224pub const LOOP_OFF               : u32 = 0x00000001;
225/// For forward looping sounds.
226pub const LOOP_NORMAL            : u32 = 0x00000002;
227/// For bidirectional looping sounds. (only works on software mixed static sounds).
228pub const LOOP_BIDI              : u32 = 0x00000004;
229/// Ignores any 3d processing. (DEFAULT).
230pub const _2D                    : u32 = 0x00000008;
231/// Makes the sound positionable in 3D. Overrides 2D
232pub const _3D                    : u32 = 0x00000010;
233/// Attempts to make sounds use hardware acceleration. (DEFAULT). Note on platforms that don't support HARDWARE (only 3DS, PS Vita, PSP, Wii and Wii U support HARDWARE), this will be internally treated as SOFTWARE.
234pub const HARDWARE               : u32 = 0x00000020;
235/// Makes the sound be mixed by the FMOD CPU based software mixer. Overrides HARDWARE. Use this for FFT, DSP, compressed sample support, 2D multi-speaker support and other software related features.
236pub const SOFTWARE               : u32 = 0x00000040;
237/// Decompress at runtime, streaming from the source provided (ie from disk). Overrides CREATESAMPLE and CREATECOMPRESSEDSAMPLE. Note a stream can only be played once at a time due to a stream only having 1 stream buffer and file handle. Open multiple streams to have them play concurrently.
238pub const CREATESTREAM           : u32 = 0x00000080;
239/// Decompress at loadtime, decompressing or decoding whole file into memory as the target sample format (ie PCM). Fastest for SOFTWARE based playback and most flexible.
240pub const CREATESAMPLE           : u32 = 0x00000100;
241/// Load MP2/MP3/IMAADPCM/CELT/Vorbis/AT9 or XMA into memory and leave it compressed. CELT/Vorbis/AT9 encoding only supported in the FSB file format. During playback the FMOD software mixer will decode it in realtime as a 'compressed sample'. Can only be used in combination with SOFTWARE. Overrides CREATESAMPLE. If the sound data is not one of the supported formats, it will behave as if it was created with CREATESAMPLE and decode the sound into PCM.
242pub const CREATECOMPRESSEDSAMPLE : u32 = 0x00000200;
243/// Opens a user created static sample or stream. Use CREATESOUNDEXINFO to specify format and/or read callbacks. If a user created 'sample' is created with no read callback, the sample will be empty. Use [`Sound::lock`](../struct.Sound.html#method.lock) and [`Sound::unlock`](../struct.Sound.html#method.unlock) to place sound data into the sound if this is the case.
244pub const OPENUSER               : u32 = 0x00000400;
245/// "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use CREATESOUNDEXINFO to specify length. If used with CREATESAMPLE or CREATECOMPRESSEDSAMPLE, FMOD duplicates the memory into its own buffers. Your own buffer can be freed after open. If used with CREATESTREAM, FMOD will stream out of the buffer whose pointer you passed in. In this case, your own buffer should not be freed until you have finished with and released the stream.
246pub const OPENMEMORY             : u32 = 0x00000800;
247/// "name_or_data" will be interpreted as a pointer to memory instead of filename for creating sounds. Use CREATESOUNDEXINFO to specify length. This differs to OPENMEMORY in that it uses the memory as is, without duplicating the memory into its own buffers. For Wii/PSP HARDWARE supports this flag for the GCADPCM/VAG formats. On other platforms SOFTWARE must be used, as sound hardware on the other platforms (ie PC) cannot access main ram. Cannot be freed after open, only after [`Sound::release`](../struct.Sound.html#method.release). Will not work if the data is compressed and CREATECOMPRESSEDSAMPLE is not used.
248pub const OPENMEMORY_POINT       : u32 = 0x10000000;
249/// Will ignore file format and treat as raw pcm. Use CREATESOUNDEXINFO to specify format. Requires at least defaultfrequency, numchannels and format to be specified before it will open. Must be little endian data.
250pub const OPENRAW                : u32 = 0x00001000;
251/// Just open the file, dont prebuffer or read. Good for fast opens for info, or when sound::readData is to be used.
252pub const OPENONLY               : u32 = 0x00002000;
253/// For [`Sys::create_sound`](../struct.Sys.html#method.create_sound) - for accurate [`Sound::get_length`](../struct.Sound.html#method.get_length) / [`Channel::set_position`](../struct.Channel.html#method.set_position) on VBR MP3, and MOD/S3M/XM/IT/MIDI files. Scans file first, so takes longer to open. OPENONLY does not affect this.
254pub const ACCURATETIME           : u32 = 0x00004000;
255/// For corrupted / bad MP3 files. This will search all the way through the file until it hits a valid MPEG header. Normally only searches for 4k.
256pub const MPEGSEARCH             : u32 = 0x00008000;
257/// For opening sounds and getting streamed subsounds (seeking) asyncronously. Use [`Sound::get_open_state`](../struct.Sound.html#method.get_open_state) to poll the state of the sound as it opens or retrieves the subsound in the background.
258pub const NONBLOCKING            : u32 = 0x00010000;
259/// Unique sound, can only be played one at a time
260pub const UNIQUE                 : u32 = 0x00020000;
261/// Make the sound's position, velocity and orientation relative to the listener.
262pub const _3D_HEADRELATIVE        : u32 = 0x00040000;
263/// Make the sound's position, velocity and orientation absolute (relative to the world). (DEFAULT)
264pub const _3D_WORLDRELATIVE       : u32 = 0x00080000;
265/// This sound will follow the inverse rolloff model where mindistance = full volume, maxdistance = where sound stops attenuating, and rolloff is fixed according to the global rolloff factor. (DEFAULT)
266pub const _3D_INVERSEROLLOFF      : u32 = 0x00100000;
267/// This sound will follow a linear rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored.
268pub const _3D_LINEARROLLOFF       : u32 = 0x00200000;
269/// This sound will follow a linear-square rolloff model where mindistance = full volume, maxdistance = silence. Rolloffscale is ignored.
270pub const _3D_LINEARSQUAREROLLOFF : u32 = 0x00400000;
271/// This sound will follow a rolloff model defined by [`Sound::set_3D_custom_rolloff`](../struct.Sound.html#method.set_3D_custom_rolloff) / [`Channel::set_3D_custom_rolloff`](../struct.Channel.html#method.set_3D_custom_rolloff).
272pub const _3D_CUSTOMROLLOFF       : u32 = 0x04000000;
273/// Is not affect by geometry occlusion. If not specified in [`Sound::set_mode`](../struct.Sound.html#method.set_mode), or [`Channel::set_mode`](../struct.Channel.html#method.set_mode), the flag is cleared and it is affected by geometry again.
274pub const _3D_IGNOREGEOMETRY      : u32 = 0x40000000;
275/// Filename is double-byte unicode.
276pub const UNICODE                : u32 = 0x01000000;
277/// Skips id3v2/asf/etc tag checks when opening a sound, to reduce seek/read overhead when opening files (helps with CD performance).
278pub const IGNORETAGS             : u32 = 0x02000000;
279/// Removes some features from samples to give a lower memory overhead, like [`Sound::get_name`](../struct.Sound.html#method.get_name). See remarks.
280pub const LOWMEM                 : u32 = 0x08000000;
281/// Load sound into the secondary RAM of supported platform. On PS3, sounds will be loaded into RSX/VRAM.
282pub const LOADSECONDARYRAM       : u32 = 0x20000000;
283/// For sounds that start virtual (due to being quiet or low importance), instead of swapping back to audible, and playing at the correct offset according to time, this flag makes the sound play from the start.
284pub const VIRTUAL_PLAYFROMSTART  : u32 = 0x80000000;
285
286/// All platforms - Initialize normally
287pub const INIT_NORMAL                    : u32 = 0x00000000;
288/// All platforms - No stream thread is created internally. Streams are driven from [`Sys::update`](../struct.Sys.html#method.update). Mainly used with non-realtime outputs.
289pub const INIT_STREAM_FROM_UPDATE        : u32 = 0x00000001;
290/// All platforms - FMOD will treat +X as right, +Y as up and +Z as backwards (towards you).
291pub const INIT_3D_RIGHTHANDED            : u32 = 0x00000002;
292/// All platforms - Disable software mixer to save memory. Anything created with SOFTWARE will fail and DSP will not work.
293pub const INIT_SOFTWARE_DISABLE          : u32 = 0x00000004;
294/// All platforms - All SOFTWARE (and HARDWARE on 3DS and NGP) with 3D based voices will add a software lowpass filter effect into the DSP chain which is automatically used when [`Channel::set_3D_occlusion`](../struct.Channel.html#method.set_3D_occlusion) is used or the geometry API.
295pub const INIT_OCCLUSION_LOWPASS         : u32 = 0x00000008;
296/// All platforms - All SOFTWARE (and HARDWARE on 3DS and NGP) with 3D based voices will add a software lowpass filter effect into the DSP chain which causes sounds to sound duller when the sound goes behind the listener. Use [`Sys::set_advanced_settings`](../struct.Sys.html#method.set_advanced_settings) to adjust Cutoff frequency.
297pub const INIT_HRTF_LOWPASS              : u32 = 0x00000010;
298/// All platforms - All SOFTWARE with 3D based voices will add a software lowpass and highpass filter effect into the DSP chain which will act as a distance-automated bandpass filter. Use [`Sys::set_advanced_settings`](../struct.Sys.html#method.set_advanced_settings) to adjust the center frequency.
299pub const INIT_DISTANCE_FILTERING        : u32 = 0x00000200;
300/// All platforms - FMOD Software reverb will preallocate enough buffers for reverb per channel, rather than allocating them and freeing them at runtime.
301pub const INIT_REVERB_PREALLOCBUFFERS    : u32 = 0x00000040;
302/// All platforms - Enable TCP/IP based host which allows FMOD Designer or FMOD Profiler to connect to it, and view memory, CPU and the DSP network graph in real-time.
303pub const INIT_ENABLE_PROFILE            : u32 = 0x00000020;
304/// All platforms - Any sounds that are 0 volume will go virtual and not be processed except for having their positions updated virtually. Use [`Sys::set_advanced_settings`](../struct.Sys.html#method.set_advanced_settings) to adjust what volume besides zero to switch to virtual at.
305pub const INIT_VOL0_BECOMES_VIRTUAL      : u32 = 0x00000080;
306/// Win32 Vista only - for WASAPI output - Enable exclusive access to hardware, lower latency at the expense of excluding other applications from accessing the audio hardware.
307pub const INIT_WASAPI_EXCLUSIVE          : u32 = 0x00000100;
308/// PS3 only - Prefer DTS over Dolby Digital if both are supported. Note: 8 and 6 channel LPCM is always preferred over both DTS and Dolby Digital.
309pub const INIT_PS3_PREFERDTS             : u32 = 0x00800000;
310/// PS3 only - Force PS3 system output mode to 2 channel LPCM.
311pub const INIT_PS3_FORCE2CHLPCM          : u32 = 0x01000000;
312/// Wii / 3DS - Disable Dolby Pro Logic surround.  will be set to STEREO even if user has selected surround in the system settings.
313pub const INIT_DISABLEDOLBY              : u32 = 0x00100000;
314/// Xbox 360 / PS3 - The "music" channelgroup which by default pauses when custom 360 dashboard / PS3 BGM music is played, can be changed to mute (therefore continues playing) instead of pausing, by using this flag.
315pub const INIT_SYSTEM_MUSICMUTENOTPAUSE  : u32 = 0x00200000;
316/// Win32/Wii/PS3/Xbox/Xbox 360 - FMOD Mixer thread is woken up to do a mix when [`Sys::update`](../struct.Sys.html#method.update) is called rather than waking periodically on its own timer.
317pub const INIT_SYNCMIXERWITHUPDATE       : u32 = 0x00400000;
318/// All platforms - With the geometry engine, only process the closest polygon rather than accumulating all polygons the sound to listener line intersects.
319pub const INIT_GEOMETRY_USECLOSEST       : u32 = 0x04000000;
320/// Win32 - Disables automatic setting of of _STEREO to _MYEARS if the MyEars profile exists on the PC. MyEars is HRTF 7.1 downmixing through headphones.
321pub const INIT_DISABLE_MYEARS_AUTODETECT : u32 = 0x08000000;
322/// PS3 only - Disable DTS output mode selection
323pub const INIT_PS3_DISABLEDTS            : u32 = 0x10000000;
324/// PS3 only - Disable Dolby Digital output mode selection
325pub const INIT_PS3_DISABLEDOLBYDIGITAL   : u32 = 0x20000000;
326/// PS3/PS4 only - FMOD uses the WAVEFORMATEX Microsoft 7.1 speaker mapping where the last 2 pairs of speakers are 'rears' then 'sides', but on PS3/PS4 these are mapped to 'surrounds' and 'backs'. Use this flag to swap fmod's last 2 pair of speakers on PS3/PS4 to avoid needing to do a special case for these platforms.
327pub const INIT_7POINT1_DOLBYMAPPING      : u32 = 0x40000000;
328
329/// Milliseconds.
330pub const TIMEUNIT_MS               : TimeUnit = TimeUnit(0x00000001);
331/// PCM samples, related to milliseconds * samplerate / 1000.
332pub const TIMEUNIT_PCM              : TimeUnit = TimeUnit(0x00000002);
333/// Bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes).
334pub const TIMEUNIT_PCMBYTES         : TimeUnit = TimeUnit(0x00000004);
335/// Raw file bytes of (compressed) sound data (does not include headers). Only used by [`Sound::get_length`](../struct.Sound.html#method.get_length) and [`Channel::get_position`](../struct.Channel.html#method.get_position).
336pub const TIMEUNIT_RAWBYTES         : TimeUnit = TimeUnit(0x00000008);
337/// Fractions of 1 PCM sample. Unsigned int range 0 to 0xFFFFFFFF. Used for sub-sample granularity for DSP purposes.
338pub const TIMEUNIT_PCMFRACTION      : TimeUnit = TimeUnit(0x00000010);
339/// MOD/S3M/XM/IT. Order in a sequenced module format. Use [`Sound::get_format`](../struct.Sound.html#method.get_format) to determine the PCM format being decoded to.
340pub const TIMEUNIT_MODORDER         : TimeUnit = TimeUnit(0x00000100);
341/// MOD/S3M/XM/IT. Current row in a sequenced module format. [`Sound::get_length`](../struct.Sound.html#method.get_length) will return the number of rows in the currently playing or seeked to pattern.
342pub const TIMEUNIT_MODROW           : TimeUnit = TimeUnit(0x00000200);
343/// MOD/S3M/XM/IT. Current pattern in a sequenced module format. [`Sound::get_length`](../struct.Sound.html#method.get_length) will return the number of patterns in the song and [`Channel::get_position`](../struct.Channel.html#method.get_position) will return the currently playing pattern.
344pub const TIMEUNIT_MODPATTERN       : TimeUnit = TimeUnit(0x00000400);
345/// Currently playing subsound in a sentence time in milliseconds.
346pub const TIMEUNIT_SENTENCE_MS      : TimeUnit = TimeUnit(0x00010000);
347/// Currently playing subsound in a sentence time in PCM Samples, related to milliseconds * samplerate / 1000.
348pub const TIMEUNIT_SENTENCE_PCM     : TimeUnit = TimeUnit(0x00020000);
349/// Currently playing subsound in a sentence time in bytes, related to PCM samples * channels * datawidth (ie 16bit = 2 bytes).
350pub const TIMEUNIT_SENTENCE_PCMBYTES: TimeUnit = TimeUnit(0x00040000);
351/// Currently playing sentence index according to the channel.
352pub const TIMEUNIT_SENTENCE         : TimeUnit = TimeUnit(0x00080000);
353/// Currently playing subsound index in a sentence.
354pub const TIMEUNIT_SENTENCE_SUBSOUND: TimeUnit = TimeUnit(0x00100000);
355/// Time value as seen by buffered stream. This is always ahead of audible time, and is only used for processing.
356pub const TIMEUNIT_BUFFERED         : TimeUnit = TimeUnit(0x10000000);
357
358/// Memory not accounted for by other types
359pub const MEMBITS_OTHER             : MemoryBits = MemoryBits(0x00000001);
360/// String data
361pub const MEMBITS_STRING            : MemoryBits = MemoryBits(0x00000002);
362/// [`Sys`](../struct.Sys.html) object and various internals
363pub const MEMBITS_SYSTEM            : MemoryBits = MemoryBits(0x00000004);
364/// Plugin objects and internals
365pub const MEMBITS_PLUGINS           : MemoryBits = MemoryBits(0x00000008);
366/// Output module object and internals
367pub const MEMBITS_OUTPUT            : MemoryBits = MemoryBits(0x00000010);
368/// [`Channel`](../struct.Channel.html) related memory
369pub const MEMBITS_CHANNEL           : MemoryBits = MemoryBits(0x00000020);
370/// [`ChannelGroup`](../struct.ChannelGroup.html) objects and internals
371pub const MEMBITS_CHANNELGROUP      : MemoryBits = MemoryBits(0x00000040);
372/// Codecs allocated for streaming
373pub const MEMBITS_CODEC             : MemoryBits = MemoryBits(0x00000080);
374/// Codecs allocated for streaming
375pub const MEMBITS_FILE              : MemoryBits = MemoryBits(0x00000100);
376/// [`Sound`](../struct.Sound.html) objects and internals
377pub const MEMBITS_SOUND             : MemoryBits = MemoryBits(0x00000200);
378/// Sound data stored in secondary RAM
379pub const MEMBITS_SOUND_SECONDARYRAM: MemoryBits = MemoryBits(0x00000400);
380/// [`SoundGroup`](../struct.SoundGroup.html) objects and internals
381pub const MEMBITS_SOUNDGROUP        : MemoryBits = MemoryBits(0x00000800);
382/// Stream buffer memory
383pub const MEMBITS_STREAMBUFFER      : MemoryBits = MemoryBits(0x00001000);
384/// [`DspConnection`](../struct.DspConnection.html) objects and internals
385pub const MEMBITS_DSPCONNECTION     : MemoryBits = MemoryBits(0x00002000);
386/// [`Dsp`](../struct.Dsp.html) implementation objects
387pub const MEMBITS_DSP               : MemoryBits = MemoryBits(0x00004000);
388/// Realtime file format decoding [`Dsp`](../struct.Dsp.html) objects
389pub const MEMBITS_DSPCODEC          : MemoryBits = MemoryBits(0x00008000);
390/// Profiler memory footprint.
391pub const MEMBITS_PROFILE           : MemoryBits = MemoryBits(0x00010000);
392/// Buffer used to store recorded data from microphone
393pub const MEMBITS_RECORDBUFFER      : MemoryBits = MemoryBits(0x00020000);
394/// [`Reverb`](../struct.Reverb.html) implementation objects
395pub const MEMBITS_REVERB            : MemoryBits = MemoryBits(0x00040000);
396/// Reverb channel properties structs
397pub const MEMBITS_REVERBCHANNELPROPS: MemoryBits = MemoryBits(0x00080000);
398/// [`Geometry`](../struct.Geometry.html) objects and internals
399pub const MEMBITS_GEOMETRY          : MemoryBits = MemoryBits(0x00100000);
400/// Sync point memory.
401pub const MEMBITS_SYNCPOINT         : MemoryBits = MemoryBits(0x00200000);
402/// All memory used by FMOD Ex
403pub const MEMBITS_ALL               : MemoryBits = MemoryBits(0xffffffff);
404
405/// EventSystem and various internals
406pub const EVENT_MEMBITS_EVENTSYSTEM          : u32 = 0x00000001;
407/// MusicSystem and various internals
408pub const EVENT_MEMBITS_MUSICSYSTEM          : u32 = 0x00000002;
409/// Definition of objects contained in all loaded projects e.g. events, groups, categories
410pub const EVENT_MEMBITS_FEV                  : u32 = 0x00000004;
411/// Data loaded with preloadFSB
412pub const EVENT_MEMBITS_MEMORYFSB            : u32 = 0x00000008;
413/// EventProject objects and internals
414pub const EVENT_MEMBITS_EVENTPROJECT         : u32 = 0x00000010;
415/// EventGroup objects and internals
416pub const EVENT_MEMBITS_EVENTGROUPI          : u32 = 0x00000020;
417/// Objects used to manage wave banks
418pub const EVENT_MEMBITS_SOUNDBANKCLASS       : u32 = 0x00000040;
419/// Data used to manage lists of wave bank usage
420pub const EVENT_MEMBITS_SOUNDBANKLIST        : u32 = 0x00000080;
421/// Stream objects and internals
422pub const EVENT_MEMBITS_STREAMINSTANCE       : u32 = 0x00000100;
423/// Sound definition objects
424pub const EVENT_MEMBITS_SOUNDDEFCLASS        : u32 = 0x00000200;
425/// Sound definition static data objects
426pub const EVENT_MEMBITS_SOUNDDEFDEFCLASS     : u32 = 0x00000400;
427/// Sound definition pool data
428pub const EVENT_MEMBITS_SOUNDDEFPOOL         : u32 = 0x00000800;
429/// Reverb definition objects
430pub const EVENT_MEMBITS_REVERBDEF            : u32 = 0x00001000;
431/// Reverb objects
432pub const EVENT_MEMBITS_EVENTREVERB          : u32 = 0x00002000;
433/// User property objects
434pub const EVENT_MEMBITS_USERPROPERTY         : u32 = 0x00004000;
435/// Event instance base objects
436pub const EVENT_MEMBITS_EVENTINSTANCE        : u32 = 0x00008000;
437/// Complex event instance objects
438pub const EVENT_MEMBITS_EVENTINSTANCE_COMPLEX: u32 = 0x00010000;
439/// Simple event instance objects
440pub const EVENT_MEMBITS_EVENTINSTANCE_SIMPLE : u32 = 0x00020000;
441/// Event layer instance objects
442pub const EVENT_MEMBITS_EVENTINSTANCE_LAYER  : u32 = 0x00040000;
443/// Event sound instance objects
444pub const EVENT_MEMBITS_EVENTINSTANCE_SOUND  : u32 = 0x00080000;
445/// Event envelope objects
446pub const EVENT_MEMBITS_EVENTENVELOPE        : u32 = 0x00100000;
447/// Event envelope definition objects
448pub const EVENT_MEMBITS_EVENTENVELOPEDEF     : u32 = 0x00200000;
449/// Event parameter objects
450pub const EVENT_MEMBITS_EVENTPARAMETER       : u32 = 0x00400000;
451/// Event category objects
452pub const EVENT_MEMBITS_EVENTCATEGORY        : u32 = 0x00800000;
453/// Event envelope point objects
454pub const EVENT_MEMBITS_EVENTENVELOPEPOINT   : u32 = 0x01000000;
455/// Event instance pool data
456pub const EVENT_MEMBITS_EVENTINSTANCEPOOL    : u32 = 0x02000000;
457/// All memory used by FMOD Event System
458pub const EVENT_MEMBITS_ALL                  : u32 = 0xffffffff;
459
460/// All event instance memory
461pub const EVENT_MEMBITS_EVENTINSTANCE_GROUP  : u32 = EVENT_MEMBITS_EVENTINSTANCE | EVENT_MEMBITS_EVENTINSTANCE_COMPLEX | EVENT_MEMBITS_EVENTINSTANCE_SIMPLE | EVENT_MEMBITS_EVENTINSTANCE_LAYER | EVENT_MEMBITS_EVENTINSTANCE_SOUND;
462/// All sound definition memory
463pub const EVENT_MEMBITS_SOUNDDEF_GROUP       : u32 = EVENT_MEMBITS_SOUNDDEFCLASS | EVENT_MEMBITS_SOUNDDEFDEFCLASS | EVENT_MEMBITS_SOUNDDEFPOOL;
464
465#[cfg(target_os = "linux")]
466mod platform {
467    #[cfg(target_arch="x86")]
468    #[link(name = "fmodex")] extern{}
469    #[cfg(target_arch="x86_64")]
470    #[link(name = "fmodex64")] extern{}
471}
472
473#[cfg(target_os = "macos")]
474mod platform {
475    #[link(name = "fmodex")] extern{}
476}
477
478#[cfg(target_os = "windows")]
479mod platform {
480    #[cfg(target_arch="x86")]
481    #[link(name = "fmodex_vc")] extern{}
482    #[cfg(target_arch="x86_64")]
483    #[link(name = "fmodex64_vc")] extern{}
484}