A thin wrapper around a Howl object with:

  • Handling of callbacks when the sound is not yet loaded.
  • Automatic clamping when calling setRate to ensure a valid value is passed to Howler.js.
  • Automatic clamping when calling setVolume so that the volume is always between 0 and 1.

Memberof

gdjs HowlerSound

Constructors

Methods

  • Get the sound playback rate. This 1 for the default speed. This value is not clamped (any value greater than 0 is valid), but the underlying audio system might not play the sound at the required rate if it's very low or very high.

    Returns number

  • Adds an event listener to the howl that removes itself after being called. If the event is play and the sound is being played, the handler is called synchronously.

    Parameters

    • event: HowlEvent
    • handler: HowlCallback

    Returns this

  • Set the playback rate. This value is not clamped (any value greater than 0 is valid), but the underlying audio system might not play the sound at the required rate if it's very low or very high.

    Parameters

    • rate: number

    Returns this

    The current instance for chaining.