Class: AudioSourceComponent

pc.AudioSourceComponent

The AudioSource Component controls playback of an audio sample. This class will be deprecated in favor of pc.SoundComponent.

Constructor

(private) new AudioSourceComponent(system, entity)

Create a new AudioSource Component
Parameters:
Name Type Description
system pc.AudioSourceComponentSystem The ComponentSystem that created this Component
entity pc.Entity The entity that the Component is attached to
Properties:
Name Type Description
assets Array.<pc.Asset> The list of audio assets - can also be an array of asset ids.
activate Boolean If true the audio will begin playing as soon as the Pack is loaded
volume Number The volume modifier to play the audio with. In range 0-1.
pitch Number The pitch modifier to play the audio with. Must be larger than 0.01
loop Boolean If true the audio will restart when it finishes playing
3d Boolean If true the audio will play back at the location of the Entity in space, so the audio will be affect by the position of the pc.AudioListenerComponent
distanceModel String Determines which algorithm to use to reduce the volume of the audio as it moves away from the listener. Can be one of 'linear', 'inverse' or 'exponential'. Default is 'inverse'.
minDistance Number The minimum distance from the listener at which audio falloff begins.
maxDistance Number The maximum distance from the listener at which audio falloff stops. Note the volume of the audio is not 0 after this distance, but just doesn't fall off anymore
rollOffFactor Number The factor used in the falloff equation.
Source:

Extends

Methods

(private) pause()

Pause playback of the audio that is playing on the Entity. Playback can be resumed by calling pc.AudioSourceComponent#unpause
Source:

(private) play(name)

Begin playback of an audio asset in the component attached to an entity
Parameters:
Name Type Description
name String The name of the Asset to play
Source:

(private) stop()

Stop playback on an Entity. Playback can not be resumed after being stopped.
Source:

(private) unpause()

Resume playback of the audio if paused. Playback is resumed at the time it was paused.
Source: