1 | /* |
2 | Copyright 2018 Google Inc. All Rights Reserved. |
3 | |
4 | Licensed under the Apache License, Version 2.0 (the "License"); |
5 | you may not use this file except in compliance with the License. |
6 | You may obtain a copy of the License at |
7 | |
8 | http://www.apache.org/licenses/LICENSE-2.0 |
9 | |
10 | Unless required by applicable law or agreed to in writing, software |
11 | distributed under the License is distributed on an "AS-IS" BASIS, |
12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | See the License for the specific language governing permissions and |
14 | limitations under the License. |
15 | */ |
16 | |
17 | // Copyright 2017 Google Inc. All rights reserved. |
18 | // |
19 | // Licensed under the Apache License, Version 2.0 (the "License"); |
20 | // you may not use this file except in compliance with the License. |
21 | // You may obtain a copy of the License at |
22 | // |
23 | // http://www.apache.org/licenses/LICENSE-2.0 |
24 | // |
25 | // Unless required by applicable law or agreed to in writing, software |
26 | // distributed under the License is distributed on an "AS-IS" BASIS, |
27 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
28 | // See the License for the specific language governing permissions and |
29 | // limitations under the License. |
30 | #ifndef RESONANCE_AUDIO_PLATFORM_COMMON_ROOM_PROPERTIES_H_ |
31 | #define RESONANCE_AUDIO_PLATFORM_COMMON_ROOM_PROPERTIES_H_ |
32 | |
33 | namespace vraudio { |
34 | |
35 | // Room surface material names, used to set room properties. |
36 | // Note that this enum is C-compatible by design to be used across external |
37 | // C/C++ and C# implementations. |
38 | enum MaterialName { |
39 | kTransparent = 0, |
40 | kAcousticCeilingTiles, |
41 | kBrickBare, |
42 | kBrickPainted, |
43 | kConcreteBlockCoarse, |
44 | kConcreteBlockPainted, |
45 | kCurtainHeavy, |
46 | kFiberGlassInsulation, |
47 | kGlassThin, |
48 | kGlassThick, |
49 | kGrass, |
50 | kLinoleumOnConcrete, |
51 | kMarble, |
52 | kMetal, |
53 | kParquetOnConcrete, |
54 | kPlasterRough, |
55 | kPlasterSmooth, |
56 | kPlywoodPanel, |
57 | kPolishedConcreteOrTile, |
58 | kSheetrock, |
59 | kWaterOrIceSurface, |
60 | kWoodCeiling, |
61 | kWoodPanel, |
62 | kUniform, |
63 | kNumMaterialNames |
64 | }; |
65 | |
66 | // Acoustic room properties. This struct can be used to describe an acoustic |
67 | // environment with a given geometry and surface properties. |
68 | // Note that this struct is C-compatible by design to be used across external |
69 | // C/C++ and C# implementations. |
70 | struct RoomProperties { |
71 | // Constructs |RoomProperties| with the default values. |
72 | RoomProperties() |
73 | : position{0.0f, 0.0f, 0.0f}, |
74 | rotation{0.0f, 0.0f, 0.0f, 1.0f}, |
75 | dimensions{0.0f, 0.0f, 0.0f}, |
76 | material_names{MaterialName::kTransparent, MaterialName::kTransparent, |
77 | MaterialName::kTransparent, MaterialName::kTransparent, |
78 | MaterialName::kTransparent, MaterialName::kTransparent}, |
79 | reflection_scalar(1.0f), |
80 | reverb_gain(1.0f), |
81 | reverb_time(1.0f), |
82 | reverb_brightness(0.0f) {} |
83 | |
84 | // Center position of the room in world space, uses right-handed coordinate |
85 | // system. |
86 | float position[3]; |
87 | |
88 | // Rotation (quaternion) of the room in world space, uses right-handed |
89 | // coordinate system. |
90 | float rotation[4]; |
91 | |
92 | // Size of the shoebox room in world space, uses right-handed coordinate |
93 | // system. |
94 | float dimensions[3]; |
95 | |
96 | // Material name of each surface of the shoebox room in this order: |
97 | // [0] (-)ive x-axis wall (left) |
98 | // [1] (+)ive x-axis wall (right) |
99 | // [2] (-)ive y-axis wall (bottom) |
100 | // [3] (+)ive y-axis wall (top) |
101 | // [4] (-)ive z-axis wall (front) |
102 | // [5] (+)ive z-axis wall (back) |
103 | MaterialName material_names[6]; |
104 | |
105 | // User defined uniform scaling factor for all reflection coefficients. |
106 | float reflection_scalar; |
107 | |
108 | // User defined reverb tail gain multiplier. |
109 | float reverb_gain; |
110 | |
111 | // Adjusts the reverberation time across all frequency bands. RT60 values |
112 | // are multiplied by this factor. Has no effect when set to 1.0f. |
113 | float reverb_time; |
114 | |
115 | // Controls the slope of a line from the lowest to the highest RT60 values |
116 | // (increases high frequency RT60s when positive, decreases when negative). |
117 | // Has no effect when set to 0.0f. |
118 | float reverb_brightness; |
119 | }; |
120 | |
121 | } // namespace vraudio |
122 | |
123 | #endif // RESONANCE_AUDIO_PLATFORM_COMMON_ROOM_PROPERTIES_H_ |
124 | |