Options
All
  • Public
  • Public/Protected
  • All
Menu

HowlerSoundManager is used to manage the sounds and musics of a RuntimeScene.

It is basically a container to associate channels to sounds and keep a list of all sounds being played.

Hierarchy

  • HowlerSoundManager

Index

Methods

  • clampRate(rate: number): number
  • Ensure rate is in a range valid for Howler.js

    Parameters

    • rate: number

    Returns number

    The clamped rate

  • clearAll(): void
  • Returns void

  • createHowlerSound(soundName: string, isMusic: boolean, volume: number, loop: boolean, rate: number): HowlerSound
  • Creates a new gdjs.HowlerSound using preloaded/cached Howl instances.

    Parameters

    • soundName: string

      The name of the file or resource to play.

    • isMusic: boolean

      True if a music, false if a sound.

    • volume: number

      Between 0 and 1.

    • loop: boolean

      True if it should be played looping.

    • rate: number

      speed at which it is played.

    Returns HowlerSound

  • getGlobalVolume(): number
  • Returns number

  • loadAudio(soundName: string, isMusic: boolean): void
  • Preloads a sound or a music in memory.

    Parameters

    • soundName: string

      The name of the file or resource to preload.

    • isMusic: boolean

      True if a music, false if a sound.

    Returns void

  • playMusic(soundName: string, loop: boolean, volume: number, pitch: number): void
  • Parameters

    • soundName: string
    • loop: boolean
    • volume: number
    • pitch: number

    Returns void

  • playMusicOnChannel(soundName: string, channel: number, loop: boolean, volume: number, pitch: number): void
  • Parameters

    • soundName: string
    • channel: number
    • loop: boolean
    • volume: number
    • pitch: number

    Returns void

  • playSound(soundName: string, loop: boolean, volume: number, pitch: number): void
  • Parameters

    • soundName: string
    • loop: boolean
    • volume: number
    • pitch: number

    Returns void

  • playSoundOnChannel(soundName: string, channel: number, loop: boolean, volume: number, pitch: number): void
  • Parameters

    • soundName: string
    • channel: number
    • loop: boolean
    • volume: number
    • pitch: number

    Returns void

  • preloadAudio(onProgress: (loadedCount: number, totalCount: number) => void, onComplete: (totalCount: number) => void, resources?: ResourceData[]): void
  • Parameters

    • onProgress: (loadedCount: number, totalCount: number) => void
        • (loadedCount: number, totalCount: number): void
        • Parameters

          • loadedCount: number
          • totalCount: number

          Returns void

    • onComplete: (totalCount: number) => void
        • (totalCount: number): void
        • Parameters

          • totalCount: number

          Returns void

    • Optional resources: ResourceData[]

    Returns void

  • setGlobalVolume(volume: number): void
  • Parameters

    • volume: number

    Returns void

  • setResources(resources: ResourceData[]): void
  • Update the resources data of the game. Useful for hot-reloading, should not be used otherwise.

    Parameters

    • resources: ResourceData[]

      The resources data of the game.

    Returns void

  • unloadAll(): void
  • Unloads all audio from memory. This will clear the Howl cache. This will also stop any running music or sounds.

    Returns void

  • unloadAudio(soundName: string, isMusic: boolean): void
  • Unloads a sound or a music from memory. This will stop any sound/music using it.

    Parameters

    • soundName: string

      The name of the file or resource to unload.

    • isMusic: boolean

      True if a music, false if a sound.

    Returns void

Constructors

Generated using TypeDoc