Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
IPlayableSound.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 a playable sound.
9  /// A playable sound can loop (ref <see cref="IsLooped"/>), be played (ref <see cref="Play"/>), be paused (ref <see cref="Pause"/>), be resumed (ref <see cref="Play"/>),
10  /// be stopped (ref <see cref="Stop()"/>) and be attenuated (ref <see cref="Volume"/>).
11  /// To query the current state of a sound use the <see cref="PlayState"/> property.
12  /// To stop a sound after its currently loop use <see cref="ExitLoop"/>
13  /// </summary>
14  public interface IPlayableSound
15  {
16  /// <summary>
17  /// The current state of the sound.
18  /// </summary>
19  SoundPlayState PlayState { get; }
20 
21  /// <summary>
22  /// Does the sound is automatically looping from beginning when it reaches the end.
23  /// </summary>
24  /// <remarks>If you want to make a sound play continuously until stopped, be sure to set IsLooped to true <bold>before</bold> you call <see cref="Play"/>.
25  /// To quit a loop when playing, use <see cref="ExitLoop"/></remarks>
26  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
27  /// <exception cref="InvalidOperationException">IsLooped cannot be modified after the sound has started to play</exception>
28  /// <seealso cref="ExitLoop"/>
29  bool IsLooped { get; set; }
30 
31  /// <summary>
32  /// Start or resume playing the sound.
33  /// </summary>
34  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
35  /// <remarks>A call to Play when the sound is already playing has no effects.</remarks>
36  void Play();
37 
38  /// <summary>
39  /// Pause the sounds.
40  /// </summary>
41  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
42  /// <remarks>A call to Pause when the sound is already paused or stopped has no effects.</remarks>
43  void Pause();
44 
45  /// <summary>
46  /// Stop playing the sound immediately and reset the sound to the beginning of the track.
47  /// </summary>
48  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
49  /// <remarks>A call to Stop when the sound is already stopped has no effects</remarks>
50  void Stop();
51 
52  /// <summary>
53  /// Stop looping. That is, do not start over at the end of the current loop, continue to play until the end of the buffer data and then stop.
54  /// </summary>
55  /// <remarks>
56  /// <para>A call to ExitLoop when the sound is Stopped or when the sound is not looping has no effects.
57  /// That is why a call to ExitLoop directly following a call to <see cref="Play"/> may be ignored (short play latency).
58  /// For a correct behaviour wait that the sound actually started playing to call ExitLoop.</para>
59  /// <para>ExitLoop does not modify the value of IsLooped.</para>
60  /// </remarks>
61  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
62  void ExitLoop();
63 
64  /// <summary>
65  /// The global volume at which the sound is played.
66  /// </summary>
67  /// <remarks>Volume is ranging from 0.0f (silence) to 1.0f (full volume). Values beyond those limits are clamped.</remarks>
68  /// <exception cref="ObjectDisposedException">The sound has already been disposed</exception>
69  float Volume { get; set; }
70  }
71 }
SoundPlayState
Current state (playing, paused, or stopped) of a sound implementing the IPlayableSound interface...
Interface for a playable sound. A playable sound can loop (ref IsLooped), be played (ref Play)...