Class Group

The base interface for any sound-producing entity, including individual sounds, groups, and playbacks. BaseSound

Implements

Constructors

Properties

_position: Position = ...
loopCount: LoopCount = 0
playIndex: number = 0
sounds: Sound[] = []

Accessors

  • get duration(): number
  • Returns number

  • get isPlaying(): boolean
  • A boolean indicating whether any of the sounds in the group are currently playing.

    Returns boolean

    True if any sound is playing, false otherwise.

  • get playbackRate(): number
  • Returns number

  • set playbackRate(rate): void
  • Parameters

    • rate: number

    Returns void

Methods

  • Plays the sounds in the group in a specific order.

    Parameters

    • shouldLoop: boolean = true

      Indicates whether the sounds should be played in a loop.

    Returns undefined | Playback

    The playback object representing the first sound being played, or undefined if the group is empty.

  • Plays a random sound from the group.

    Returns undefined | Playback

    The playback object representing the played sound, or undefined if the group is empty.

  • Prepares the sounds in the group for playback in a specific order.

    Parameters

    • shouldLoop: boolean = true

      Indicates whether the sounds should be prepared for looping.

    Returns undefined | Playback

    The playback object representing the first sound being prepared, or undefined if the group is empty.

  • Prepares a random sound from the group for playback.

    Returns undefined | Playback

    The playback object representing the prepared sound.

    Throws

    Error if the group is empty and there are no sounds to prepare.

  • Returns a random sound from the group.

    Returns Sound

    A random Sound object from the group.

    Throws

    Error if the group is empty.