rfmod/
callbacks.rs

1/*
2* Rust-FMOD - Copyright (c) 2016 Gomez Guillaume.
3*
4* The Original software, FMOD 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
25use dsp;
26use sound;
27use types::TimeUnit;
28use fmod_sys;
29use file;
30
31/*pub type SystemCallback = Option<fn(fmod: &Sys, _type:SystemCallbackType, command_data1: *mut c_void,
32    command_data2: *mut c_void) -> ::Status>;*/
33
34/* file callbacks */
35pub type FileOpenCallback = Option<fn(name: &str, unicode: i32) -> Option<(file::FmodFile, Option<fmod_sys::UserData>)>>;
36pub type FileCloseCallback = Option<fn(handle: &mut file::FmodFile, user_data: Option<&mut fmod_sys::UserData>)>;
37pub type FileReadCallback = Option<fn(handle: &mut file::FmodFile, buffer: &mut [u8], size_to_read: u32, user_data: Option<&mut fmod_sys::UserData>) -> usize>;
38pub type FileSeekCallback = Option<fn(handle: &mut file::FmodFile, pos: u32, user_data: Option<&mut fmod_sys::UserData>)>;
39/*pub type FMOD_FILE_ASYNCREADCALLBACK = Option<extern "C" fn(arg1: *mut FMOD_ASYNCREADINFO, arg2: *mut c_void) -> ::Status>;
40pub type FMOD_FILE_ASYNCCANCELCALLBACK = Option<extern "C" fn(arg1: *mut c_void, arg2: *mut c_void, arg3: c_uint) -> ::Status>;*/
41
42/// sound callback
43pub type SoundNonBlockCallback = Option<fn(sound: &sound::Sound, result: ::Status) -> ::Status>;
44/// callback which allow to set/change data that will be played
45pub type SoundPcmReadCallback = Option<fn(sound: &sound::Sound, data: &mut [i16]) -> ::Status>;
46/// notify the user that music position has changed
47pub type SoundPcmSetPosCallback = Option<fn(sound: &sound::Sound, sub_sound: i32, position: u32, postype: TimeUnit) -> ::Status>;
48
49/*  codec callbacks */
50/*pub type FMOD_CODEC_OPENCALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, user_mode: FMOD_MODE, userexinfo: *mut FMOD_CREATESOUNDEXINFO) -> ::Status>;
51pub type FMOD_CODEC_CLOSECALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE) -> ::Status>;
52pub type FMOD_CODEC_READCALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, buffer: *mut c_void, size_bytes: c_uint, bytes_read: *mut c_uint) -> ::Status>;
53pub type FMOD_CODEC_GETLENGTHCALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, length: *mut c_uint, length_type: FMOD_TIMEUNIT) -> ::Status>;
54pub type FMOD_CODEC_SETPOSITIONCALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, sub_sound: c_int, position: c_uint, postype: FMOD_TIMEUNIT) -> ::Status>;
55pub type FMOD_CODEC_GETPOSITIONCALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, position: *mut c_uint, postype: FMOD_TIMEUNIT) -> ::Status>;
56pub type FMOD_CODEC_SOUNDCREATECALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, sub_sound: c_int, sound: *mut FMOD_SOUND) -> ::Status>;
57pub type FMOD_CODEC_METADATACALLBACK = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, tag_type:TagType, name: *mut c_char, data: *mut c_void,
58        data_len: c_uint, data_type:TagDataType, unique: c_int) -> ::Status>;
59pub type FMOD_CODEC_GETWAVEFORMAT = Option<extern "C" fn(codec_state: *mut FMOD_CODEC_STATE, index: c_int, wave_format: *mut FMOD_CODEC_WAVEFORMAT) -> ::Status>;
60pub type FMOD_3D_ROLLOFFCALLBACK = Option<extern "C" fn(channel: *mut FMOD_CHANNEL, distance: c_float) -> ::Status>;*/
61
62/// notify the user that the DSP has been created
63pub type DspCreateCallback = Option<fn(dsp_state: &dsp::DspState) -> ::Status>;
64/// notify the user that the DSP has been released
65pub type DspReleaseCallback = Option<fn(dsp_state: &dsp::DspState) -> ::Status>;
66/// notify the user that the DSP has been reset
67pub type DspResetCallback = Option<fn(dsp_state: &dsp::DspState) -> ::Status>;
68/// allow the user to modify data that will be read
69pub type DspReadCallback = Option<fn(dsp_state: &dsp::DspState, in_buffer: &mut [f32], out_buffer: &mut [f32], length: u32, inchannels: i32, outchannels: i32) -> ::Status>;
70/// notify the user that DSP position has changed
71pub type DspSetPositionCallback = Option<fn(dsp_state: &dsp::DspState, pos: u32) -> ::Status>;
72/// DSP callback
73pub type DspSetParamCallback = Option<fn(dsp_state: &dsp::DspState, index: i32, value: f32) -> ::Status>;
74/// DSP callback
75pub type DspGetParamCallback = Option<fn(dsp_state: &dsp::DspState, index: i32, value: &mut f32, value_str: &str) -> ::Status>;
76/// DSP callback, not implemented yet
77pub type DspDialogCallback = Option<fn(dsp_state: dsp::DspState/*, hwnd: *mut c_void*/, show: i32) -> ::Status>;