Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
AudioEmitter.cs
Go to the documentation of this file.
1 // Copyright (c) 2014 Silicon Studio Corp. (http://siliconstudio.co.jp)
2 // This file is distributed under GPL v3. See LICENSE.md for details.
3 
4 using System;
5 
6 using SiliconStudio.Core.Mathematics;
7 
8 namespace SiliconStudio.Paradox.Audio
9 {
10  /// <summary>
11  /// Represents a 3D audio emitter in the audio scene.
12  /// This object, used in combination with an <see cref="AudioListener"/>, can simulate 3D audio localization effects for a given sound implementing the <see cref="IPositionableSound"/> interface.
13  /// For more details take a look at the <see cref="IPositionableSound.Apply3D"/> function.
14  /// </summary>
15  /// <seealso cref="IPositionableSound.Apply3D"/>
16  /// <seealso cref="AudioListener"/>
17  public class AudioEmitter
18  {
19  /// <summary>
20  /// The position of the emitter in the 3D world.
21  /// </summary>
22  public Vector3 Position { get; set; }
23 
24  /// <summary>
25  /// The velocity of the emitter in the 3D world.
26  /// </summary>
27  /// <remarks>This is only used to calculate the doppler effect on the sound effect</remarks>
28  public Vector3 Velocity { get; set; }
29 
30  /// <summary>
31  /// The scalar applied to the level of Doppler effect calculated between this and the listener
32  /// </summary>
33  /// <remarks>
34  /// By default, this value is 1.0.
35  /// This value determines how much to modify the calculated Doppler effect between this object and a AudioListener.
36  /// Values below 1.0 scale down the Doppler effect to make it less apparent.
37  /// Values above 1.0 exaggerate the Doppler effect. A value of 1.0 leaves the effect unmodified.
38  /// Note that this value modifies only the calculated Doppler between this object and a AudioListener.
39  /// The calculated Doppler is a product of the relationship between AudioEmitter.Velocity and AudioListener.Velocity.
40  /// If the calculation yields a result of no Doppler effect, this value has no effect.
41  /// </remarks>
42  /// <exception cref="ArgumentOutOfRangeException">The doppler scale of an audio emitter must be greater than or equal to zero.</exception>
43  public float DopplerScale
44  {
45  get
46  {
47  return dopplerScale;
48  }
49 
50  set
51  {
52  if (value < 0)
53  throw new ArgumentOutOfRangeException();
54 
55  dopplerScale = value;
56  }
57  }
58  private float dopplerScale;
59 
60  /// <summary>
61  /// Distance scale used to calculate the signal attenuation with the listener
62  /// </summary>
63  /// <remarks>
64  /// By default, this value is 1.0.
65  /// This value represent the distance unit and determines how quicly the signal attenuates between this object and the AudioListener.
66  /// Values below 1.0 exaggerate the attenuation to make it more apparent.
67  /// Values above 1.0 scale down the attenuation. A value of 1.0 leaves the default attenuation unchanged.
68  /// Note that this value modifies only the calculated attenuation between this object and a AudioListener.
69  /// The calculated attenuation is a product of the relationship between AudioEmitter.Position and AudioListener.Position.
70  /// If the calculation yields a result of no attenuation effect, this value has no effect.
71  /// </remarks>
72  /// <exception cref="ArgumentOutOfRangeException">The distance scale of an audio emitter must be greater than zero.</exception>
73  public float DistanceScale
74  {
75  get
76  {
77  return distanceScale;
78  }
79 
80  set
81  {
82  if (value <= 0)
83  throw new ArgumentOutOfRangeException();
84 
85  distanceScale = value;
86  }
87  }
88  private float distanceScale;
89 
90  /// <summary>
91  /// Create a new instance of <see cref="AudioEmitter"/>.
92  /// </summary>
93  public AudioEmitter()
94  {
95  DopplerScale = 1;
96  DistanceScale = 1;
97  }
98  }
99 }
Represents a three dimensional mathematical vector.
Definition: Vector3.cs:42
AudioEmitter()
Create a new instance of AudioEmitter.
Definition: AudioEmitter.cs:93
Represents a 3D audio emitter in the audio scene. This object, used in combination with an AudioListe...
Definition: AudioEmitter.cs:17