Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Sound

Each instance can manage a sound or music for the duration of the application

Hierarchy

  • Sound

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

  • new Sound(fileUrl: string): Sound
  • Initialises instance with the managed sound.

    Parameters

    • fileUrl: string

      url of the sound file

    Returns Sound

Properties

Protected _complete

_complete: boolean

Load status

Protected data

data: AudioBuffer

Memory buffer of audio file

Protected source

source: AudioBufferSourceNode

Source used to play sound

Static Protected context

context: AudioContext

Global audioContext

Accessors

complete

  • get complete(): boolean
  • Checks if audio read is complete. Complete does not mean playable!

    Returns boolean

Methods

Private _play

  • _play(loop?: boolean): void
  • Internal method to play sound

    Parameters

    • Default value loop: boolean = false

      if the sound or music should be looped

    Returns void

play

  • play(loop?: boolean): boolean
  • Plays sound

    Parameters

    • Default value loop: boolean = false

      if the sound or music should be looped

    Returns boolean

    true if the data is available and the command was executed

stop

  • stop(): boolean

Generated using TypeDoc