Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Sound

[13:7] extends: FxObj

Wraps FXGL's Sound, a short audio clip (typically loaded from a .wav file). Sound is a simple holder around an Audio object; the actual play / pause / stop / volume controls live on the Audio. Use audio() to obtain the Audio wrapper for those operations.

Methods

  • Sound (Ajo = null)

    Wraps an existing Sound AussomJavaObject. Normally obtained through fxgl.getAssetLoader().loadSound(...) rather than constructed directly.

    • @p Ajo is an AussomJavaObject around an FXGL Sound.
  • audio ()

    Returns the underlying Audio wrapper, on which play / pause / stop / setVolume / setLooping live.

    • @r An Audio wrapper.
  • isDisposed ()

    Returns true if dispose has been called on this Sound. The underlying Sound class marks its disposed flag as Kotlin internal, so the JVM method name is mangled to isDisposed$fxgl_core.

    • @r A bool.
  • getAudio ()

    Returns the underlying Audio AJO that backs this sound.

  • dispose ()

    Disposes the sound and releases any backing native resources. Use this when the wrapping engine is shutting down a scene.