Class: Meter

Meter(container, audioContext, oopt)

Class representing a Volume Meter widget.

Constructor

new Meter(container, audioContext, oopt)

Parameters:
Name Type Attributes Description
container object DOM container for the widget.
audioContext AudioContext The audio context to be used.
o object <optional>
Options object.
Properties
Name Type Attributes Default Description
backgroundColor string <optional>
"#282828" The background color.
initAmplitude number <optional>
0 The initial amplitude to be displayed (range of 0. - 1.)
Implements:
  • Widget
Source:

Methods

_calcAmplitude(buffer)

Calculate the amplitude for a given audio buffer
Parameters:
Name Type Description
buffer Float32Array
Source:

_calcPeak()

Calculate the current peak
Source:

_initAudioModules(audioCtx)

Initialize the audio modules necessary to analyse the volume.
Parameters:
Name Type Description
audioCtx AudioContext The audio context to use.
Source:

(private) _initCanvasElements()

Initialize the canvas elements.
Source:

(private) _initOptions()

Initialize the options.
Source:

(private) _update()

Update (redraw) component based on state.
Source:

receiveAudioFrom(audioSource)

Recieve audio from a source.
Parameters:
Name Type Description
audioSource AudioNode The audio source to connect.
Source: