Class: SoundManager

pc.SoundManager

The SoundManager is used to load and play audio. As well as apply system-wide settings like global volume, suspend and resume.

Constructor

new SoundManager(optionsopt)

Creates a new sound manager.
Parameters:
Name Type Attributes Description
options Object <optional>
Options options object.
Properties
Name Type Attributes Description
forceWebAudioApi Boolean <optional>
Always use the Web Audio API even check indicates that it if not available
Properties:
Name Type Description
volume Number Global volume for the manager. All pc.SoundInstances will scale their volume with this volume. Valid between [0, 1].
Source:

Methods

(private, static) hasAudio() → {Boolean}

Reports whether this device supports the HTML5 Audio tag API
Source:
Returns:
true if HTML5 Audio tag API is supported and false otherwise
Type
Boolean

(private, static) hasAudioContext() → {Boolean}

Reports whether this device supports the Web Audio API
Source:
Returns:
true if Web Audio is supported and false otherwise
Type
Boolean

(private) playSound(sound, options) → {pc.Channel}

Create a new pc.Channel and begin playback of the sound.
Parameters:
Name Type Description
sound pc.Sound The Sound object to play.
options Object Optional options object.
Properties
Name Type Attributes Description
volume Number <optional>
The volume to playback at, between 0 and 1.
loop Boolean <optional>
Whether to loop the sound when it reaches the end.
Source:
Returns:
The channel playing the sound.
Type
pc.Channel

(private) playSound3d(sound, position, options) → {pc.Channel3d}

Create a new pc.Channel3d and begin playback of the sound at the position specified
Parameters:
Name Type Description
sound pc.Sound The Sound object to play.
position pc.Vec3 The position of the sound in 3D space.
options Object Optional options object.
Properties
Name Type Attributes Description
volume Number <optional>
The volume to playback at, between 0 and 1.
loop Boolean <optional>
Whether to loop the sound when it reaches the end.
Source:
Returns:
The 3D channel playing the sound.
Type
pc.Channel3d