Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IPositionableSound.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 using System;
4 
5 namespace SiliconStudio.Paradox.Audio
6 {
7  /// <summary>
8  /// Interface for 3D localizable sound.
9  /// The interface currently supports only mono and stereo sounds (ref <see cref="Pan"/>).
10  /// The user can localize its sound with <see cref="Apply3D"/> by creating one <see cref="AudioEmitter"/>
11  /// and one <see cref="AudioListener"/> respectly corresponding to the source of the sound and the listener.
12  /// The <see cref="Pan"/> function enable the user to change the distribution of sound between the left and right speakers.
13  /// </summary>
14  /// <remarks>Functions <see cref="Pan"/> and <see cref="Apply3D"/> cannot be used together.
15  /// A call to <see cref="Apply3D"/> will reset <see cref="Pan"/> to its default value and inverse.</remarks>
16  /// <seealso cref="SoundEffect"/>
17  /// <seealso cref="SoundEffectInstance"/>
18  /// <seealso cref="DynamicSoundEffectInstance"/>
20  {
21  /// <summary>
22  /// Set the sound balance between left and right speaker.
23  /// </summary>
24  /// <remarks>Panning is ranging from -1.0f (full left) to 1.0f (full right). 0.0f is centered. Values beyond this range are clamped.
25  /// Panning modifies the total energy of the signal (Pan == -1 => Energy = 1 + 0, Pan == 0 => Energy = 1 + 1, Pan == 0.5 => Energy = 1 + 0.5, ...)
26  /// <para>A call to <see cref="Pan"/> cancels the effect of Apply3D.</para></remarks>
27  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
28  float Pan { get; set; }
29 
30  /// <summary>
31  /// Applies 3D positioning to the sound.
32  /// More precisely adjust the channel volumes and pitch of the sound,
33  /// such that the sound source seems to come from the <paramref name="emitter"/> to the <paramref name="listener"/>.
34  /// </summary>
35  /// <param name="listener">The sound listener of the scene</param>
36  /// <param name="emitter">The emitter that correspond to this sound</param>
37  /// <remarks>
38  /// <see cref="Apply3D"/> can be used only on mono-sounds.
39  /// <para>A call to <see cref="Apply3D"/> reset <see cref="Pan"/> to its default values.</para>
40  /// <para>A call to <see cref="Apply3D"/> does not modify the value of <see cref="IPlayableSound.Volume"/>,
41  /// the effective volume of the sound is a combination of the two effects.</para>
42  /// <para>
43  /// The final resulting pitch depends on the listener and emitter relative velocity.
44  /// The final resulting channel volumes depend on the listener and emitter relative positions and the value of <see cref="IPlayableSound.Volume"/>.
45  /// The intensity of the doppler and attenuation effects can be adjusted using the <see cref="AudioEmitter.DopplerScale"/> and <see cref="AudioEmitter.DistanceScale"/> properties.
46  /// </para>
47  /// </remarks>
48  /// <seealso cref="AudioListener"/>
49  /// <seealso cref="AudioEmitter"/>
50  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
51  /// <exception cref="ArgumentNullException">Provided listener or emitter is null</exception>
52  /// <exception cref="InvalidOperationException">The sound has more than one channels. 3D positioning can be applied only to mono-sounds.</exception>
53  void Apply3D(AudioListener listener, AudioEmitter emitter);
54 
55  /// <summary>
56  /// Cancel the effect of possible previous calls to <see cref="Apply3D"/>.
57  /// </summary>
58  /// <remarks>Do not revert <see cref="Pan"/> to its value before <see cref="Apply3D"/>.</remarks>
59  void Reset3D();
60  }
61 }
Represents a 3D audio listener in the audio scene. This object, used in combination with an AudioEmit...
Interface for a playable sound. A playable sound can loop (ref IsLooped), be played (ref Play)...
Represents a 3D audio emitter in the audio scene. This object, used in combination with an AudioListe...
Definition: AudioEmitter.cs:17
Interface for 3D localizable sound. The interface currently supports only mono and stereo sounds (ref...