Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Audio

[15:7] extends: FxObj

Wraps FXGL's Audio, the abstract base for both Music and Sound payloads. The concrete subclasses (DesktopMusic, DesktopSound) are loader-internal so Aussom users usually receive an Audio through Sound.audio or Music.audio rather than constructing one directly. Exposes the play / pause / stop / setVolume / setLooping / setOnFinished controls common to every backend.

Methods

  • Audio (Ajo = null)

    Wraps an existing Audio AussomJavaObject.

    • @p Ajo is an AussomJavaObject around an FXGL Audio.
  • setLooping (bool Looping)

    Sets whether the audio loops when it reaches the end.

    • @p Looping is a bool.
    • @r this object
  • setVolume (double Volume)

    Sets the playback volume in the range 0.0 to 1.0.

    • @p Volume is a double with the volume.
    • @r this object
  • setOnFinished (callback Cb)

    Registers a callback that runs when playback finishes (only fires for non-looping audio).

    • @p Cb is a callback with no arguments.
    • @r this object
  • play ()

    Starts or resumes playback.

    • @r this object
  • pause ()

    Pauses playback at the current position.

    • @r this object
  • stop ()

    Stops playback and resets to the start.

    • @r this object