Show / Hide Table of Contents

    Interface ISoundPlayer

    Allows to play a sound.

    Namespace: AGS.API
    Assembly: AGS.API.dll
    Syntax
    public interface ISoundPlayer

    Properties

    | Improve this Doc View Source

    CurrentlyPlayingSounds

    Gets a list of currently playing sounds for this audio clip.

    Declaration
    ReadOnlyCollection<ISound> CurrentlyPlayingSounds { get; }
    Property Value
    Type Description
    System.Collections.ObjectModel.ReadOnlyCollection<ISound>

    The list of currently playing sounds.

    | Improve this Doc View Source

    IsPlaying

    Gets a value indicating whether this ISoundPlayer is playing a sound (or more than 1 sound).

    Declaration
    bool IsPlaying { get; }
    Property Value
    Type Description
    System.Boolean

    true if is playing; otherwise, false.

    | Improve this Doc View Source

    OnSoundCompleted

    An event which is sent when an existing sound has completed playing.

    Declaration
    IBlockingEvent<ISound> OnSoundCompleted { get; }
    Property Value
    Type Description
    IBlockingEvent<ISound>

    The event.

    | Improve this Doc View Source

    OnSoundStarted

    An event which is sent when a new sound starts playing.

    Declaration
    IBlockingEvent<ISound> OnSoundStarted { get; }
    Property Value
    Type Description
    IBlockingEvent<ISound>

    The event.

    Methods

    | Improve this Doc View Source

    Play(Boolean, ISoundProperties)

    Plays a sound.

    Declaration
    ISound Play(bool shouldLoop = false, ISoundProperties properties = null)
    Parameters
    Type Name Description
    System.Boolean shouldLoop

    If set to true should loop.

    ISoundProperties properties

    Properties.

    Returns
    Type Description
    ISound
    Examples

    In order to play a sound and then asynchronously wait for it to finish:

    private async Task onSpecificTrigger()
    {
        ISound sound = myAudioClip.Play();
        doStuffWhileSoundIsPlaying(); //This happens in parallel to the playing sound
        await sound.Completed;
        doStuffAfterSoundFinishedPlaying();
    }
    | Improve this Doc View Source

    Play(Single, Boolean)

    Plays a sound

    Declaration
    ISound Play(float volume, bool shouldLoop = false)
    Parameters
    Type Name Description
    System.Single volume

    Volume (allowed values: 0-1, see ISoundPropertie).

    System.Boolean shouldLoop

    If set to true should loop.

    Returns
    Type Description
    ISound
    | Improve this Doc View Source

    PlayAndWait(ISoundProperties)

    Plays a sound and blocks until the sound is completed.

    Declaration
    void PlayAndWait(ISoundProperties properties = null)
    Parameters
    Type Name Description
    ISoundProperties properties

    Properties.

    | Improve this Doc View Source

    PlayAndWait(Single)

    Plays a sound and blocks until the sound is completed.

    Declaration
    void PlayAndWait(float volume)
    Parameters
    Type Name Description
    System.Single volume

    Volume (allowed values: 0-1, see ISoundPropertie).

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX