Interface ISound
An instance of a playing sound. You'll usually use an IAudioClip to play a sound, and control the playing sound from this interface.
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
public interface ISound : ISoundProperties
Properties
| Improve this Doc View SourceCompleted
A task that can be used to await a playing sound asynchronously until it completes (do not use on a looping sound).
Declaration
Task Completed { get; }
Property Value
Type | Description |
---|---|
System.Threading.Tasks.Task | The completed. |
Examples
private async Task onMusicBoxInteract()
{
ISound sound = musicBoxAudioClip.Play();
await cHero.SayAsync("The music box is currently playing a song..."); //We didn't wait for the sound to complete yet, so the character is speaking in parallel
await sound.Completed;
await cHero.SayAsync("What a nice song that was!");
}
|
Improve this Doc
View Source
Duration
Gets duration of the sound in seconds.
Declaration
float Duration { get; }
Property Value
Type | Description |
---|---|
System.Single |
HasCompleted
Has this ISound completed playing?
Declaration
bool HasCompleted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsLooping
Is this ISound looping (i.e running in an endless loop)?
Declaration
bool IsLooping { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsPaused
Is this ISound paused?
Declaration
bool IsPaused { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsValid
Is the sound a valid sound and expected to play properly, or is there some audio problem and this is a dummy object?
Declaration
bool IsValid { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Position
Gets or sets the playback position within the sound in seconds.
Declaration
float Position { get; set; }
Property Value
Type | Description |
---|---|
System.Single | The position. |
RealPanning
Gets the real panning of the sound (after it has been modified by all the existing sound modifiers).
Declaration
float RealPanning { get; }
Property Value
Type | Description |
---|---|
System.Single | The real panning. |
See Also
| Improve this Doc View SourceRealPitch
Gets the real pitch of the sound (after it has been modified by all the existing sound modifiers).
Declaration
float RealPitch { get; }
Property Value
Type | Description |
---|---|
System.Single | The real pitch. |
See Also
| Improve this Doc View SourceRealVolume
Gets the real volume of the sound (after it has been modified by all the existing sound modifiers).
Declaration
float RealVolume { get; }
Property Value
Type | Description |
---|---|
System.Single | The real volume. |
See Also
| Improve this Doc View SourceSoundModifiers
A list of modifiers for sound properties. The sound modifiers act on the existing sound properties that you set (volume, panning, pitch), and modify them on-the-fly (for example, the engine has a rule where the volume of non-speech sounds is reduced when speech is playing).
Declaration
IAGSBindingList<ISoundModifier> SoundModifiers { get; }
Property Value
Type | Description |
---|---|
IAGSBindingList<ISoundModifier> | The list of sound modifiers. |
See Also
| Improve this Doc View SourceSourceID
An internal id for the source that is playing the sound. This can be used if low-level OpenAL access is needed, but for regular uses can be ignored.
Declaration
int SourceID { get; }
Property Value
Type | Description |
---|---|
System.Int32 | The source identifier. |
Methods
| Improve this Doc View SourcePause()
Pause this sound.
Declaration
void Pause()
Resume()
Resume this sound (if the sound is already playing, or already completed, then it does nothing).
Declaration
void Resume()
Rewind()
Rewind this sound to the beginning (if the sound has already completed, then it does nothing).
Declaration
void Rewind()
Stop()
Stop this sound (if the sound has already completed, then it does nothing).
Declaration
void Stop()