API Docs for:
Show:

gs.AudioBufferReference Class

An audio buffer reference is a reference to an already existing audio buffer. It allows to play the audio buffer independent from other references. This is useful for sound-effects which are played very often and quickly at the same time.

Constructor

gs.AudioBufferReference

(
  • audioBuffer
  • [useAnalyser=false]
)

Parameters:

  • audioBuffer gs.AudioBuffer
    • The audio buffer to create a reference to.
  • [useAnalyser=false] Boolean optional
    • If true the sound-data is analyzed in real-time to get data like the average-volume.

Methods

dispose

()

Disposes the audio buffer reference and frees the resources/memory. Should be called if the reference is no longer needed. The associated audio buffer is not disposed.

play

()

Plays the audio buffer reference.

stop

()

Stops the audio buffer reference.

Properties

audioBuffer

gs.AudioBuffer

Reference to the audio-buffer.

context

Object

Reference to the audio-context.

customData

Object

An object which allows to store custom data.

Default: {}

isPlaying

Boolean

Indicates if the audio buffer is currently playing.

playbackRate

Number

The play-back rate in percent.

useAnalyser

Boolean

Indicates if the sound is analyzed in real-time to get data like the average-volume.

Default: false

volume

Number

The volume. Goes from 0 to 100.