rfmod/reverb_properties.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 ffi;
26use std::default::Default;
27
28pub fn from_ptr(pointer: ffi::FMOD_REVERB_PROPERTIES) -> ReverbProperties {
29 ReverbProperties {
30 instance: pointer.Instance,
31 environment: pointer.Environment,
32 env_diffusion: pointer.EnvDiffusion,
33 room: pointer.Room,
34 room_HF: pointer.RoomHF,
35 room_LF: pointer.RoomLF,
36 decay_time: pointer.DecayTime,
37 decay_HF_ratio: pointer.DecayHFRatio,
38 decay_LF_ratio: pointer.DecayLFRatio,
39 reflections: pointer.Reflections,
40 reflections_delay: pointer.ReflectionsDelay,
41 reverb: pointer.Reverb,
42 reverb_delay: pointer.ReverbDelay,
43 modulation_time: pointer.ModulationTime,
44 modulation_depth: pointer.ModulationDepth,
45 HF_reference: pointer.HFReference,
46 LF_reference: pointer.LFReference,
47 diffusion: pointer.Diffusion,
48 density: pointer.Density,
49 flags: pointer.Flags,
50 }
51}
52
53pub fn get_ffi(reverb: ReverbProperties) -> ffi::FMOD_REVERB_PROPERTIES {
54 ffi::FMOD_REVERB_PROPERTIES {
55 Instance: reverb.instance,
56 Environment: reverb.environment,
57 EnvDiffusion: reverb.env_diffusion,
58 Room: reverb.room,
59 RoomHF: reverb.room_HF,
60 RoomLF: reverb.room_LF,
61 DecayTime: reverb.decay_time,
62 DecayHFRatio: reverb.decay_HF_ratio,
63 DecayLFRatio: reverb.decay_LF_ratio,
64 Reflections: reverb.reflections,
65 ReflectionsDelay: reverb.reflections_delay,
66 Reverb: reverb.reverb,
67 ReverbDelay: reverb.reverb_delay,
68 ModulationTime: reverb.modulation_time,
69 ModulationDepth: reverb.modulation_depth,
70 HFReference: reverb.HF_reference,
71 LFReference: reverb.LF_reference,
72 Diffusion: reverb.diffusion,
73 Density: reverb.density,
74 Flags: reverb.flags,
75 }
76}
77
78/// Structure defining a reverb environment.
79#[derive(Clone, Copy)]
80pub struct ReverbProperties {
81 /// [w] Min: 0 - Max: 3 - Default: 0 - Environment Instance. (SUPPORTED:SFX(4 instances) and Wii (3 instances))
82 pub instance : i32,
83 /// [r/w] Min: -1 - Max: 25 - Default: -1 - Sets all listener properties. -1 = OFF. (SUPPORTED:SFX(-1 only)/PSP)
84 pub environment : i32,
85 /// [r/w] Min: 0.0 - Max: 1.0 - Default: 1.0 - Environment diffusion (SUPPORTED:WII)
86 pub env_diffusion : f32,
87 /// [r/w] Min: -10000 - Max: 0 - Default: -1000 - Room effect level (at mid frequencies) (SUPPORTED:SFX/WII/PSP)
88 pub room : i32,
89 /// [r/w] Min: -10000 - Max: 0 - Default: -100 - Relative room effect level at high frequencies (SUPPORTED:SFX)
90 pub room_HF : i32,
91 /// [r/w] Min: -10000 - Max: 0 Default: 0 - Relative room effect level at low frequencies (SUPPORTED:SFX)
92 pub room_LF : i32,
93 /// [r/w] Min: 0.1 - Max: 20.0 - Default: 1.49 - Reverberation decay time at mid frequencies (SUPPORTED:SFX/WII)
94 pub decay_time : f32,
95 /// [r/w] Min: 0.1 - Max: 2.0 - Default: 0.83 - High-frequency to mid-frequency decay time ratio (SUPPORTED:SFX)
96 pub decay_HF_ratio : f32,
97 /// [r/w] Min: 0.1 - Max: 2.0 - Default: 1.0 - Low-frequency to mid-frequency decay time ratio (SUPPORTED:---)
98 pub decay_LF_ratio : f32,
99 /// [r/w] Min: -10000 - Max: 1000 - Default: -2602 - Early reflections level relative to room effect (SUPPORTED:SFX/WII)
100 pub reflections : i32,
101 /// [r/w] Min: 0.0 - Max: 0.3 - Default: 0.007 - Initial reflection delay time (SUPPORTED:SFX)
102 pub reflections_delay: f32,
103 /// [r/w] Min: -10000 - Max: 2000 - Default: 200 - Late reverberation level relative to room effect (SUPPORTED:SFX)
104 pub reverb : i32,
105 /// [r/w] Min: 0.0 - Max: 0.1 - Default: 0.011 - Late reverberation delay time relative to initial reflection (SUPPORTED:SFX/WII)
106 pub reverb_delay : f32,
107 /// [r/w] Min: 0.04 - Max: 4.0 - Default: 0.25 - Modulation time (SUPPORTED:---)
108 pub modulation_time : f32,
109 /// [r/w] Min: 0.0 - Max: 1.0 - Default: 0.0 - Modulation depth (SUPPORTED:WII)
110 pub modulation_depth : f32,
111 /// [r/w] Min: 20.0 - Max: 20000.0 - Default: 5000.0 - Reference high frequency (hz) (SUPPORTED:SFX)
112 pub HF_reference : f32,
113 /// [r/w] Min: 20.0 - Max: 1000.0 - Default: 250.0 - Reference low frequency (hz) (SUPPORTED:SFX)
114 pub LF_reference : f32,
115 /// [r/w] Min: 0.0 - Max: 100.0 - Default: 100.0 - Value that controls the echo density in the late reverberation decay. (SUPPORTED:SFX)
116 pub diffusion : f32,
117 /// [r/w] Min: 0.0 - Max: 100.0 - Default: 100.0 - Value that controls the modal density in the late reverberation decay (SUPPORTED:SFX)
118 pub density : f32,
119 /// [r/w] FMOD_REVERB_FLAGS - modifies the behavior of above properties (SUPPORTED:WII)
120 pub flags : u32
121}
122
123impl Default for ReverbProperties {
124 fn default() -> ReverbProperties {
125 ReverbProperties {
126 instance: 0i32,
127 environment: -1i32,
128 env_diffusion: 1.0f32,
129 room: -1000i32,
130 room_HF: -100i32,
131 room_LF: 0i32,
132 decay_time: 1.49f32,
133 decay_HF_ratio: 0.83f32,
134 decay_LF_ratio: 1f32,
135 reflections: -2602i32,
136 reflections_delay: 0.007f32,
137 reverb: 200i32,
138 reverb_delay: 0.011f32,
139 modulation_time: 0.25f32,
140 modulation_depth: 0f32,
141 HF_reference: 5000f32,
142 LF_reference: 250f32,
143 diffusion: 100f32,
144 density: 100f32,
145 flags: 0u32,
146 }
147 }
148}