| 1 | /************************************************************************************ |
| 2 | Filename : ONSPPropagationMaterial.cs |
| 3 | Content : Propagation material class |
| 4 | Attach to geometry to define material properties |
| 5 | Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved. |
| 6 | |
| 7 | Licensed under the Oculus SDK Version 3.5 (the "License"); |
| 8 | you may not use the Oculus SDK except in compliance with the License, |
| 9 | which is provided at the time of installation or download, or which |
| 10 | otherwise accompanies this software in either electronic or hard copy form. |
| 11 | |
| 12 | You may obtain a copy of the License at |
| 13 | |
| 14 | https://developer.oculus.com/licenses/sdk-3.5/ |
| 15 | |
| 16 | Unless required by applicable law or agreed to in writing, the Oculus SDK |
| 17 | distributed under the License is distributed on an "AS IS" BASIS, |
| 18 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 19 | See the License for the specific language governing permissions and |
| 20 | limitations under the License. |
| 21 | ************************************************************************************/ |
| 22 | using System; |
| 23 | using System.Linq; |
| 24 | using System.Collections.Generic; |
| 25 | using UnityEngine; |
| 26 | using Oculus.Spatializer.Propagation; |
| 27 | |
| 28 | public sealed class ONSPPropagationMaterial : MonoBehaviour |
| 29 | { |
| 30 | public enum Preset |
| 31 | { |
| 32 | Custom, |
| 33 | AcousticTile, |
| 34 | Brick, |
| 35 | BrickPainted, |
| 36 | Carpet, |
| 37 | CarpetHeavy, |
| 38 | CarpetHeavyPadded, |
| 39 | CeramicTile, |
| 40 | Concrete, |
| 41 | ConcreteRough, |
| 42 | ConcreteBlock, |
| 43 | ConcreteBlockPainted, |
| 44 | Curtain, |
| 45 | Foliage, |
| 46 | Glass, |
| 47 | GlassHeavy, |
| 48 | Grass, |
| 49 | Gravel, |
| 50 | GypsumBoard, |
| 51 | PlasterOnBrick, |
| 52 | PlasterOnConcreteBlock, |
| 53 | Soil, |
| 54 | SoundProof, |
| 55 | Snow, |
| 56 | Steel, |
| 57 | Water, |
| 58 | WoodThin, |
| 59 | WoodThick, |
| 60 | WoodFloor, |
| 61 | WoodOnConcrete |
| 62 | } |
| 63 | |
| 64 | [Serializable] |
| 65 | public sealed class Point |
| 66 | { |
| 67 | public float frequency; |
| 68 | public float data; |
| 69 | |
| 70 | public Point( float frequency = 0, float data = 0 ) |
| 71 | { |
| 72 | this.frequency = frequency; |
| 73 | this.data = data; |
| 74 | } |
| 75 | |
| 76 | public static implicit operator Point(Vector2 v) |
| 77 | { |
| 78 | return new Point(v.x, v.y); |
| 79 | } |
| 80 | |
| 81 | public static implicit operator Vector2(Point point) |
| 82 | { |
| 83 | return new Vector2(point.frequency, point.data); |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | [Serializable] |
| 88 | public sealed class Spectrum |
| 89 | { |
| 90 | public int selection = int.MaxValue; |
| 91 | public List<Point> points = new List<Point>(); |
| 92 | |
| 93 | public float this[float f] |
| 94 | { |
| 95 | |
| 96 | get |
| 97 | { |
| 98 | |
| 99 | if (points.Count > 0) |
| 100 | { |
| 101 | |
| 102 | Point lower = new Point(float.MinValue); |
| 103 | Point upper = new Point(float.MaxValue); |
| 104 | |
| 105 | foreach (Point point in points) |
| 106 | { |
| 107 | if (point.frequency < f) |
| 108 | { |
| 109 | if (point.frequency > lower.frequency) |
| 110 | lower = point; |
| 111 | } |
| 112 | else |
| 113 | { |
| 114 | if (point.frequency < upper.frequency) |
| 115 | upper = point; |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | if (lower.frequency == float.MinValue) |
| 120 | lower.data = points.OrderBy(p => p.frequency).First().data; |
| 121 | if (upper.frequency == float.MaxValue) |
| 122 | upper.data = points.OrderBy(p => p.frequency).Last().data; |
| 123 | |
| 124 | return lower.data + (f - lower.frequency) * |
| 125 | (upper.data - lower.data) / (upper.frequency - lower.frequency); |
| 126 | |
| 127 | } |
| 128 | |
| 129 | return 0f; |
| 130 | |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | //*********************************************************************** |
| 136 | // Private Fields |
| 137 | |
| 138 | public IntPtr materialHandle = IntPtr.Zero; |
| 139 | |
| 140 | //*********************************************************************** |
| 141 | // Public Fields |
| 142 | |
| 143 | [Tooltip("Absorption")] |
| 144 | public Spectrum absorption = new Spectrum(); |
| 145 | [Tooltip("Transmission")] |
| 146 | public Spectrum transmission = new Spectrum(); |
| 147 | [Tooltip("Scattering")] |
| 148 | public Spectrum scattering = new Spectrum(); |
| 149 | |
| 150 | [SerializeField] |
| 151 | private Preset preset_ = Preset.Custom; |
| 152 | public Preset preset |
| 153 | { |
| 154 | get { return preset_; } |
| 155 | set |
| 156 | { |
| 157 | this.SetPreset( value ); |
| 158 | preset_ = value; |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | //*********************************************************************** |
| 163 | // Start / Destroy |
| 164 | |
| 165 | /// Initialize the audio material. This is called after Awake() and before the first Update(). |
| 166 | void Start() |
| 167 | { |
| 168 | StartInternal(); |
| 169 | } |
| 170 | |
| 171 | public void StartInternal() |
| 172 | { |
| 173 | // Ensure that the material is not initialized twice. |
| 174 | if ( materialHandle != IntPtr.Zero ) |
| 175 | return; |
| 176 | |
| 177 | // Create the internal material. |
| 178 | if (ONSPPropagation.Interface.CreateAudioMaterial( out materialHandle ) != ONSPPropagationGeometry.OSPSuccess) |
| 179 | throw new Exception("Unable to create internal audio material"); |
| 180 | |
| 181 | // Run the updates to initialize the material. |
| 182 | UploadMaterial(); |
| 183 | } |
| 184 | |
| 185 | /// Destroy the audio scene. This is called when the scene is deleted. |
| 186 | void OnDestroy() |
| 187 | { |
| 188 | DestroyInternal(); |
| 189 | } |
| 190 | |
| 191 | public void DestroyInternal() |
| 192 | { |
| 193 | if ( materialHandle != IntPtr.Zero ) |
| 194 | { |
| 195 | // Destroy the material. |
| 196 | ONSPPropagation.Interface.DestroyAudioMaterial(materialHandle); |
| 197 | materialHandle = IntPtr.Zero; |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | //*********************************************************************** |
| 202 | // Upload |
| 203 | |
| 204 | public void UploadMaterial() |
| 205 | { |
| 206 | if ( materialHandle == IntPtr.Zero ) |
| 207 | return; |
| 208 | |
| 209 | // Absorption |
| 210 | ONSPPropagation.Interface.AudioMaterialReset(materialHandle, MaterialProperty.ABSORPTION); |
| 211 | |
| 212 | foreach ( Point p in absorption.points ) |
| 213 | ONSPPropagation.Interface.AudioMaterialSetFrequency(materialHandle, MaterialProperty.ABSORPTION, |
| 214 | p.frequency, p.data ); |
| 215 | |
| 216 | // Transmission |
| 217 | ONSPPropagation.Interface.AudioMaterialReset(materialHandle, MaterialProperty.TRANSMISSION); |
| 218 | |
| 219 | foreach (Point p in transmission.points) |
| 220 | ONSPPropagation.Interface.AudioMaterialSetFrequency(materialHandle, MaterialProperty.TRANSMISSION, |
| 221 | p.frequency, p.data); |
| 222 | |
| 223 | // Scattering |
| 224 | ONSPPropagation.Interface.AudioMaterialReset(materialHandle, MaterialProperty.SCATTERING); |
| 225 | |
| 226 | foreach (Point p in scattering.points) |
| 227 | ONSPPropagation.Interface.AudioMaterialSetFrequency(materialHandle, MaterialProperty.SCATTERING, |
| 228 | p.frequency, p.data); |
| 229 | |
| 230 | } |
| 231 | |
| 232 | //*********************************************************************** |
| 233 | |
| 234 | public void SetPreset(Preset preset ) |
| 235 | { |
| 236 | ONSPPropagationMaterial material = this; |
| 237 | |
| 238 | switch ( preset ) |
| 239 | { |
| 240 | case Preset.AcousticTile: AcousticTile(ref material); break; |
| 241 | case Preset.Brick: Brick(ref material); break; |
| 242 | case Preset.BrickPainted: BrickPainted(ref material); break; |
| 243 | case Preset.Carpet: Carpet(ref material); break; |
| 244 | case Preset.CarpetHeavy: CarpetHeavy(ref material); break; |
| 245 | case Preset.CarpetHeavyPadded: CarpetHeavyPadded(ref material); break; |
| 246 | case Preset.CeramicTile: CeramicTile(ref material); break; |
| 247 | case Preset.Concrete: Concrete(ref material); break; |
| 248 | case Preset.ConcreteRough: ConcreteRough(ref material); break; |
| 249 | case Preset.ConcreteBlock: ConcreteBlock(ref material); break; |
| 250 | case Preset.ConcreteBlockPainted: ConcreteBlockPainted(ref material); break; |
| 251 | case Preset.Curtain: Curtain(ref material); break; |
| 252 | case Preset.Foliage: Foliage(ref material); break; |
| 253 | case Preset.Glass: Glass(ref material); break; |
| 254 | case Preset.GlassHeavy: GlassHeavy(ref material); break; |
| 255 | case Preset.Grass: Grass(ref material); break; |
| 256 | case Preset.Gravel: Gravel(ref material); break; |
| 257 | case Preset.GypsumBoard: GypsumBoard(ref material); break; |
| 258 | case Preset.PlasterOnBrick: PlasterOnBrick(ref material); break; |
| 259 | case Preset.PlasterOnConcreteBlock: PlasterOnConcreteBlock(ref material); break; |
| 260 | case Preset.Soil: Soil(ref material); break; |
| 261 | case Preset.SoundProof: SoundProof(ref material); break; |
| 262 | case Preset.Snow: Snow(ref material); break; |
| 263 | case Preset.Steel: Steel(ref material); break; |
| 264 | case Preset.Water: Water(ref material); break; |
| 265 | case Preset.WoodThin: WoodThin(ref material); break; |
| 266 | case Preset.WoodThick: WoodThick(ref material); break; |
| 267 | case Preset.WoodFloor: WoodFloor(ref material); break; |
| 268 | case Preset.WoodOnConcrete: WoodOnConcrete(ref material); break; |
| 269 | case Preset.Custom: |
| 270 | break; |
| 271 | default: |
| 272 | break; |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | //*********************************************************************** |
| 277 | |
| 278 | private static void AcousticTile(ref ONSPPropagationMaterial material) |
| 279 | { |
| 280 | material.absorption.points = new List<Point>{ |
| 281 | new Point(125f, .50f), new Point(250f, .70f), new Point(500f, .60f), new Point(1000f, .70f), new Point(2000f, .70f), new Point(4000f, .50f) }; |
| 282 | |
| 283 | material.scattering.points = new List<Point>{ |
| 284 | new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .20f), new Point(2000f, .25f), new Point(4000f, .30f) }; |
| 285 | |
| 286 | material.transmission.points = new List<Point>(){ |
| 287 | new Point(125f, .05f), new Point(250f, .04f), new Point(500f, .03f), new Point(1000f, .02f), new Point(2000f, .005f), new Point(4000f, .002f) }; |
| 288 | } |
| 289 | |
| 290 | private static void Brick(ref ONSPPropagationMaterial material) |
| 291 | { |
| 292 | material.absorption.points = new List<Point>{ |
| 293 | new Point(125f, .02f), new Point(250f, .02f), new Point(500f, .03f), new Point(1000f, .04f), new Point(2000f, .05f), new Point(4000f, .07f) }; |
| 294 | |
| 295 | material.scattering.points = new List<Point>{ |
| 296 | new Point(125f, .20f), new Point(250f, .25f), new Point(500f, .30f), new Point(1000f, .35f), new Point(2000f, .40f), new Point(4000f, .45f) }; |
| 297 | |
| 298 | material.transmission.points = new List<Point>(){ |
| 299 | new Point(125f, .025f), new Point(250f, .019f), new Point(500f, .01f), new Point(1000f, .0045f), new Point(2000f, .0018f), new Point(4000f, .00089f) }; |
| 300 | } |
| 301 | |
| 302 | private static void BrickPainted(ref ONSPPropagationMaterial material) |
| 303 | { |
| 304 | material.absorption.points = new List<Point>{ |
| 305 | new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .02f), new Point(1000f, .02f), new Point(2000f, .02f), new Point(4000f, .03f) }; |
| 306 | |
| 307 | material.scattering.points = new List<Point>{ |
| 308 | new Point(125f, .15f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .20f), new Point(2000f, .20f), new Point(4000f, .25f) }; |
| 309 | |
| 310 | material.transmission.points = new List<Point>(){ |
| 311 | new Point(125f, .025f), new Point(250f, .019f), new Point(500f, .01f), new Point(1000f, .0045f), new Point(2000f, .0018f), new Point(4000f, .00089f) }; |
| 312 | } |
| 313 | |
| 314 | private static void Carpet(ref ONSPPropagationMaterial material) |
| 315 | { |
| 316 | material.absorption.points = new List<Point>{ |
| 317 | new Point(125f, .01f), new Point(250f, .05f), new Point(500f, .10f), new Point(1000f, .20f), new Point(2000f, .45f), new Point(4000f, .65f) }; |
| 318 | |
| 319 | material.scattering.points = new List<Point>{ |
| 320 | new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .15f), new Point(1000f, .20f), new Point(2000f, .30f), new Point(4000f, .45f) }; |
| 321 | |
| 322 | material.transmission.points = new List<Point>(){ |
| 323 | new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) }; |
| 324 | } |
| 325 | |
| 326 | private static void CarpetHeavy(ref ONSPPropagationMaterial material) |
| 327 | { |
| 328 | material.absorption.points = new List<Point>{ |
| 329 | new Point(125f, .02f), new Point(250f, .06f), new Point(500f, .14f), new Point(1000f, .37f), new Point(2000f, .48f), new Point(4000f, .63f) }; |
| 330 | |
| 331 | material.scattering.points = new List<Point>{ |
| 332 | new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .25f), new Point(2000f, .35f), new Point(4000f, .50f) }; |
| 333 | |
| 334 | material.transmission.points = new List<Point>(){ |
| 335 | new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) }; |
| 336 | } |
| 337 | |
| 338 | private static void CarpetHeavyPadded(ref ONSPPropagationMaterial material) |
| 339 | { |
| 340 | material.absorption.points = new List<Point>{ |
| 341 | new Point(125f, .08f), new Point(250f, .24f), new Point(500f, .57f), new Point(1000f, .69f), new Point(2000f, .71f), new Point(4000f, .73f) }; |
| 342 | |
| 343 | material.scattering.points = new List<Point>{ |
| 344 | new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .25f), new Point(2000f, .35f), new Point(4000f, .50f) }; |
| 345 | |
| 346 | material.transmission.points = new List<Point>(){ |
| 347 | new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) }; |
| 348 | } |
| 349 | |
| 350 | private static void CeramicTile(ref ONSPPropagationMaterial material) |
| 351 | { |
| 352 | material.absorption.points = new List<Point>{ |
| 353 | new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .01f), new Point(1000f, .01f), new Point(2000f, .02f), new Point(4000f, .02f) }; |
| 354 | |
| 355 | material.scattering.points = new List<Point>{ |
| 356 | new Point(125f, .10f), new Point(250f, .12f), new Point(500f, .14f), new Point(1000f, .16f), new Point(2000f, .18f), new Point(4000f, .20f) }; |
| 357 | |
| 358 | material.transmission.points = new List<Point>(){ |
| 359 | new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) }; |
| 360 | } |
| 361 | |
| 362 | private static void Concrete(ref ONSPPropagationMaterial material) |
| 363 | { |
| 364 | material.absorption.points = new List<Point>{ |
| 365 | new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .02f), new Point(1000f, .02f), new Point(2000f, .02f), new Point(4000f, .02f) }; |
| 366 | |
| 367 | material.scattering.points = new List<Point>{ |
| 368 | new Point(125f, .10f), new Point(250f, .11f), new Point(500f, .12f), new Point(1000f, .13f), new Point(2000f, .14f), new Point(4000f, .15f) }; |
| 369 | |
| 370 | material.transmission.points = new List<Point>(){ |
| 371 | new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) }; |
| 372 | } |
| 373 | |
| 374 | private static void ConcreteRough(ref ONSPPropagationMaterial material) |
| 375 | { |
| 376 | material.absorption.points = new List<Point>{ |
| 377 | new Point(125f, .01f), new Point(250f, .02f), new Point(500f, .04f), new Point(1000f, .06f), new Point(2000f, .08f), new Point(4000f, .10f) }; |
| 378 | |
| 379 | material.scattering.points = new List<Point>{ |
| 380 | new Point(125f, .10f), new Point(250f, .12f), new Point(500f, .15f), new Point(1000f, .20f), new Point(2000f, .25f), new Point(4000f, .30f) }; |
| 381 | |
| 382 | material.transmission.points = new List<Point>(){ |
| 383 | new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) }; |
| 384 | } |
| 385 | |
| 386 | private static void ConcreteBlock(ref ONSPPropagationMaterial material) |
| 387 | { |
| 388 | material.absorption.points = new List<Point>{ |
| 389 | new Point(125f, .36f), new Point(250f, .44f), new Point(500f, .31f), new Point(1000f, .29f), new Point(2000f, .39f), new Point(4000f, .21f) }; |
| 390 | |
| 391 | material.scattering.points = new List<Point>{ |
| 392 | new Point(125f, .10f), new Point(250f, .12f), new Point(500f, .15f), new Point(1000f, .20f), new Point(2000f, .30f), new Point(4000f, .40f) }; |
| 393 | |
| 394 | material.transmission.points = new List<Point>(){ |
| 395 | new Point(125f, .02f), new Point(250f, .01f), new Point(500f, .0063f), new Point(1000f, .0035f), new Point(2000f, .00011f), new Point(4000f, .00063f) }; |
| 396 | } |
| 397 | |
| 398 | private static void ConcreteBlockPainted(ref ONSPPropagationMaterial material) |
| 399 | { |
| 400 | material.absorption.points = new List<Point>{ |
| 401 | new Point(125f, .10f), new Point(250f, .05f), new Point(500f, .06f), new Point(1000f, .07f), new Point(2000f, .09f), new Point(4000f, .08f) }; |
| 402 | |
| 403 | material.scattering.points = new List<Point>{ |
| 404 | new Point(125f, .10f), new Point(250f, .11f), new Point(500f, .13f), new Point(1000f, .15f), new Point(2000f, .16f), new Point(4000f, .20f) }; |
| 405 | |
| 406 | material.transmission.points = new List<Point>(){ |
| 407 | new Point(125f, .02f), new Point(250f, .01f), new Point(500f, .0063f), new Point(1000f, .0035f), new Point(2000f, .00011f), new Point(4000f, .00063f) }; |
| 408 | } |
| 409 | |
| 410 | private static void Curtain(ref ONSPPropagationMaterial material) |
| 411 | { |
| 412 | material.absorption.points = new List<Point>{ |
| 413 | new Point(125f, .07f), new Point(250f, .31f), new Point(500f, .49f), new Point(1000f, .75f), new Point(2000f, .70f), new Point(4000f, .60f) }; |
| 414 | |
| 415 | material.scattering.points = new List<Point>{ |
| 416 | new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .2f), new Point(1000f, .3f), new Point(2000f, .4f), new Point(4000f, .5f) }; |
| 417 | |
| 418 | material.transmission.points = new List<Point>(){ |
| 419 | new Point(125f, .42f), new Point(250f, .39f), new Point(500f, .21f), new Point(1000f, .14f), new Point(2000f, .079f), new Point(4000f, .045f) }; |
| 420 | } |
| 421 | |
| 422 | private static void Foliage(ref ONSPPropagationMaterial material) |
| 423 | { |
| 424 | material.absorption.points = new List<Point>{ |
| 425 | new Point(125f, .03f), new Point(250f, .06f), new Point(500f, .11f), new Point(1000f, .17f), new Point(2000f, .27f), new Point(4000f, .31f) }; |
| 426 | |
| 427 | material.scattering.points = new List<Point>{ |
| 428 | new Point(125f, .20f), new Point(250f, .3f), new Point(500f, .4f), new Point(1000f, .5f), new Point(2000f, .7f), new Point(4000f, .8f) }; |
| 429 | |
| 430 | material.transmission.points = new List<Point>(){ |
| 431 | new Point(125f, .9f), new Point(250f, .9f), new Point(500f, .9f), new Point(1000f, .8f), new Point(2000f, .5f), new Point(4000f, .3f) }; |
| 432 | } |
| 433 | |
| 434 | private static void Glass(ref ONSPPropagationMaterial material) |
| 435 | { |
| 436 | material.absorption.points = new List<Point>{ |
| 437 | new Point(125f, .35f), new Point(250f, .25f), new Point(500f, .18f), new Point(1000f, .12f), new Point(2000f, .07f), new Point(4000f, .05f) }; |
| 438 | |
| 439 | material.scattering.points = new List<Point>{ |
| 440 | new Point(125f, .05f), new Point(250f, .05f), new Point(500f, .05f), new Point(1000f, .05f), new Point(2000f, .05f), new Point(4000f, .05f) }; |
| 441 | |
| 442 | material.transmission.points = new List<Point>(){ |
| 443 | new Point(125f, .125f), new Point(250f, .089f), new Point(500f, .05f), new Point(1000f, .028f), new Point(2000f, .022f), new Point(4000f, .079f) }; |
| 444 | } |
| 445 | |
| 446 | private static void GlassHeavy(ref ONSPPropagationMaterial material) |
| 447 | { |
| 448 | material.absorption.points = new List<Point>{ |
| 449 | new Point(125f, .18f), new Point(250f, .06f), new Point(500f, .04f), new Point(1000f, .03f), new Point(2000f, .02f), new Point(4000f, .02f) }; |
| 450 | |
| 451 | material.scattering.points = new List<Point>{ |
| 452 | new Point(125f, .05f), new Point(250f, .05f), new Point(500f, .05f), new Point(1000f, .05f), new Point(2000f, .05f), new Point(4000f, .05f) }; |
| 453 | |
| 454 | material.transmission.points = new List<Point>(){ |
| 455 | new Point(125f, .056f), new Point(250f, .039f), new Point(500f, .028f), new Point(1000f, .02f), new Point(2000f, .032f), new Point(4000f, .014f) }; |
| 456 | } |
| 457 | |
| 458 | private static void Grass(ref ONSPPropagationMaterial material) |
| 459 | { |
| 460 | material.absorption.points = new List<Point>{ |
| 461 | new Point(125f, .11f), new Point(250f, .26f), new Point(500f, .60f), new Point(1000f, .69f), new Point(2000f, .92f), new Point(4000f, .99f) }; |
| 462 | |
| 463 | material.scattering.points = new List<Point>{ |
| 464 | new Point(125f, .30f), new Point(250f, .30f), new Point(500f, .40f), new Point(1000f, .50f), new Point(2000f, .60f), new Point(4000f, .70f) }; |
| 465 | |
| 466 | material.transmission.points = new List<Point>(); |
| 467 | } |
| 468 | |
| 469 | private static void Gravel(ref ONSPPropagationMaterial material) |
| 470 | { |
| 471 | material.absorption.points = new List<Point>{ |
| 472 | new Point(125f, .25f), new Point(250f, .60f), new Point(500f, .65f), new Point(1000f, .70f), new Point(2000f, .75f), new Point(4000f, .80f) }; |
| 473 | |
| 474 | material.scattering.points = new List<Point>{ |
| 475 | new Point(125f, .20f), new Point(250f, .30f), new Point(500f, .40f), new Point(1000f, .50f), new Point(2000f, .60f), new Point(4000f, .70f) }; |
| 476 | |
| 477 | material.transmission.points = new List<Point>(); |
| 478 | } |
| 479 | |
| 480 | private static void GypsumBoard(ref ONSPPropagationMaterial material) |
| 481 | { |
| 482 | material.absorption.points = new List<Point>{ |
| 483 | new Point(125f, .29f), new Point(250f, .10f), new Point(500f, .05f), new Point(1000f, .04f), new Point(2000f, .07f), new Point(4000f, .09f) }; |
| 484 | |
| 485 | material.scattering.points = new List<Point>{ |
| 486 | new Point(125f, .10f), new Point(250f, .11f), new Point(500f, .12f), new Point(1000f, .13f), new Point(2000f, .14f), new Point(4000f, .15f) }; |
| 487 | |
| 488 | material.transmission.points = new List<Point>(){ |
| 489 | new Point(125f, .035f), new Point(250f, .0125f), new Point(500f, .0056f), new Point(1000f, .0025f), new Point(2000f, .0013f), new Point(4000f, .0032f) }; |
| 490 | } |
| 491 | |
| 492 | private static void PlasterOnBrick(ref ONSPPropagationMaterial material) |
| 493 | { |
| 494 | material.absorption.points = new List<Point>{ |
| 495 | new Point(125f, .01f), new Point(250f, .02f), new Point(500f, .02f), new Point(1000f, .03f), new Point(2000f, .04f), new Point(4000f, .05f) }; |
| 496 | |
| 497 | material.scattering.points = new List<Point>{ |
| 498 | new Point(125f, .20f), new Point(250f, .25f), new Point(500f, .30f), new Point(1000f, .35f), new Point(2000f, .40f), new Point(4000f, .45f) }; |
| 499 | |
| 500 | material.transmission.points = new List<Point>(){ |
| 501 | new Point(125f, .025f), new Point(250f, .019f), new Point(500f, .01f), new Point(1000f, .0045f), new Point(2000f, .0018f), new Point(4000f, .00089f) }; |
| 502 | } |
| 503 | |
| 504 | private static void PlasterOnConcreteBlock(ref ONSPPropagationMaterial material) |
| 505 | { |
| 506 | material.absorption.points = new List<Point>{ |
| 507 | new Point(125f, .12f), new Point(250f, .09f), new Point(500f, .07f), new Point(1000f, .05f), new Point(2000f, .05f), new Point(4000f, .04f) }; |
| 508 | |
| 509 | material.scattering.points = new List<Point>{ |
| 510 | new Point(125f, .20f), new Point(250f, .25f), new Point(500f, .30f), new Point(1000f, .35f), new Point(2000f, .40f), new Point(4000f, .45f) }; |
| 511 | |
| 512 | material.transmission.points = new List<Point>(){ |
| 513 | new Point(125f, .02f), new Point(250f, .01f), new Point(500f, .0063f), new Point(1000f, .0035f), new Point(2000f, .00011f), new Point(4000f, .00063f) }; |
| 514 | } |
| 515 | |
| 516 | private static void Soil(ref ONSPPropagationMaterial material) |
| 517 | { |
| 518 | material.absorption.points = new List<Point>{ |
| 519 | new Point(125f, .15f), new Point(250f, .25f), new Point(500f, .40f), new Point(1000f, .55f), new Point(2000f, .60f), new Point(4000f, .60f) }; |
| 520 | |
| 521 | material.scattering.points = new List<Point>{ |
| 522 | new Point(125f, .10f), new Point(250f, .20f), new Point(500f, .25f), new Point(1000f, .40f), new Point(2000f, .55f), new Point(4000f, .70f) }; |
| 523 | |
| 524 | material.transmission.points = new List<Point>(); |
| 525 | } |
| 526 | |
| 527 | private static void SoundProof(ref ONSPPropagationMaterial material) |
| 528 | { |
| 529 | material.absorption.points = new List<Point>{ new Point(1000f, 1.0f) }; |
| 530 | material.scattering.points = new List<Point>{ new Point(1000f, 0.0f) }; |
| 531 | material.transmission.points = new List<Point>(); |
| 532 | } |
| 533 | |
| 534 | private static void Snow(ref ONSPPropagationMaterial material) |
| 535 | { |
| 536 | material.absorption.points = new List<Point>{ |
| 537 | new Point(125f, .45f), new Point(250f, .75f), new Point(500f, .90f), new Point(1000f, .95f), new Point(2000f, .95f), new Point(4000f, .95f) }; |
| 538 | |
| 539 | material.scattering.points = new List<Point>{ |
| 540 | new Point(125f, .20f), new Point(250f, .30f), new Point(500f, .40f), new Point(1000f, .50f), new Point(2000f, .60f), new Point(4000f, .75f) }; |
| 541 | |
| 542 | material.transmission.points = new List<Point>(); |
| 543 | } |
| 544 | |
| 545 | private static void Steel(ref ONSPPropagationMaterial material) |
| 546 | { |
| 547 | material.absorption.points = new List<Point>{ |
| 548 | new Point(125f, .05f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .07f), new Point(4000f, .02f) }; |
| 549 | |
| 550 | material.scattering.points = new List<Point>{ |
| 551 | new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .10f) }; |
| 552 | |
| 553 | material.transmission.points = new List<Point>(){ |
| 554 | new Point(125f, .25f), new Point(250f, .2f), new Point(500f, .17f), new Point(1000f, .089f), new Point(2000f, .089f), new Point(4000f, .0056f) }; |
| 555 | } |
| 556 | |
| 557 | private static void Water(ref ONSPPropagationMaterial material) |
| 558 | { |
| 559 | material.absorption.points = new List<Point>{ |
| 560 | new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .01f), new Point(1000f, .02f), new Point(2000f, .02f), new Point(4000f, .03f) }; |
| 561 | |
| 562 | material.scattering.points = new List<Point>{ |
| 563 | new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .07f), new Point(2000f, .05f), new Point(4000f, .05f) }; |
| 564 | |
| 565 | material.transmission.points = new List<Point>(){ |
| 566 | new Point(125f, .03f), new Point(250f, .03f), new Point(500f, .03f), new Point(1000f, .02f), new Point(2000f, .015f), new Point(4000f, .01f) }; |
| 567 | } |
| 568 | |
| 569 | private static void WoodThin(ref ONSPPropagationMaterial material) |
| 570 | { |
| 571 | material.absorption.points = new List<Point>{ |
| 572 | new Point(125f, .42f), new Point(250f, .21f), new Point(500f, .10f), new Point(1000f, .08f), new Point(2000f, .06f), new Point(4000f, .06f) }; |
| 573 | |
| 574 | material.scattering.points = new List<Point>{ |
| 575 | new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) }; |
| 576 | |
| 577 | material.transmission.points = new List<Point>(){ |
| 578 | new Point(125f, .2f), new Point(250f, .125f), new Point(500f, .079f), new Point(1000f, .1f), new Point(2000f, .089f), new Point(4000f, .05f) }; |
| 579 | } |
| 580 | |
| 581 | private static void WoodThick(ref ONSPPropagationMaterial material) |
| 582 | { |
| 583 | material.absorption.points = new List<Point>{ |
| 584 | new Point(125f, .19f), new Point(250f, .14f), new Point(500f, .09f), new Point(1000f, .06f), new Point(2000f, .06f), new Point(4000f, .05f) }; |
| 585 | |
| 586 | material.scattering.points = new List<Point>{ |
| 587 | new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) }; |
| 588 | |
| 589 | material.transmission.points = new List<Point>(){ |
| 590 | new Point(125f, .035f), new Point(250f, .028f), new Point(500f, .028f), new Point(1000f, .028f), new Point(2000f, .011f), new Point(4000f, .0071f) }; |
| 591 | } |
| 592 | |
| 593 | private static void WoodFloor(ref ONSPPropagationMaterial material) |
| 594 | { |
| 595 | material.absorption.points = new List<Point>{ |
| 596 | new Point(125f, .15f), new Point(250f, .11f), new Point(500f, .10f), new Point(1000f, .07f), new Point(2000f, .06f), new Point(4000f, .07f) }; |
| 597 | |
| 598 | material.scattering.points = new List<Point>{ |
| 599 | new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) }; |
| 600 | |
| 601 | material.transmission.points = new List<Point>(){ |
| 602 | new Point(125f, .071f), new Point(250f, .025f), new Point(500f, .0158f), new Point(1000f, .0056f), new Point(2000f, .0035f), new Point(4000f, .0016f) }; |
| 603 | } |
| 604 | |
| 605 | private static void WoodOnConcrete(ref ONSPPropagationMaterial material) |
| 606 | { |
| 607 | material.absorption.points = new List<Point>{ |
| 608 | new Point(125f, .04f), new Point(250f, .04f), new Point(500f, .07f), new Point(1000f, .06f), new Point(2000f, .06f), new Point(4000f, .07f) }; |
| 609 | |
| 610 | material.scattering.points = new List<Point>{ |
| 611 | new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) }; |
| 612 | |
| 613 | material.transmission.points = new List<Point>(){ |
| 614 | new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) }; |
| 615 | } |
| 616 | } |