Class: Channel

pc.Channel

A channel is created when the pc.AudioManager begins playback of a pc.Sound. Usually created internally by pc.AudioManager#playSound or pc.AudioManager#playSound3d. Developers usually won't have to create Channels manually.

Constructor

(private) new Channel(manager, sound, optionsopt)

Parameters:
Name Type Attributes Description
manager pc.AudioManager The AudioManager instance
sound pc.Sound The sound to playback
options Object <optional>
Optional options object.
Properties
Name Type Attributes Default Description
volume Number <optional>
1 The playback volume, between 0 and 1.
pitch Number <optional>
1 The relative pitch, default of 1, plays at normal pitch.
loop Boolean <optional>
false Whether the sound should loop when it reaches the end or not.
Source:

Methods

(private) getLoop() → {Boolean}

Get the current looping state of the Channel
Source:
Returns:
The loop property for the channel.
Type
Boolean

(private) getPitch() → {Number}

Get the current pitch of the Channel
Source:
Returns:
The pitch of the channel.
Type
Number

(private) getVolume() → {Number}

Get the current value for the volume. Between 0 and 1.
Source:
Returns:
The volume of the channel.
Type
Number

(private) onManagerResume()

Handle the manager's 'resume' event.
Source:

(private) onManagerSuspend()

Handle the manager's 'suspend' event.
Source:

(private) onManagerVolumeChange()

Handle the manager's 'volumechange' event.
Source:

(private) pause()

Pause playback of sound. Call unpause() to resume playback from the same position
Source:

(private) play()

Begin playback of sound
Source:

(private) setLoop(loop)

Enable/disable the loop property to make the sound restart from the beginning when it reaches the end.
Parameters:
Name Type Description
loop Boolean true to loop the sound, false otherwise.
Source:

(private) setVolume(volume)

Set the volume of playback between 0 and 1.
Parameters:
Name Type Description
volume Number The volume of the sound. Will be clamped between 0 and 1.
Source:

(private) stop()

Stop playback of sound. Calling play() again will restart playback from the beginning of the sound.
Source:

(private) unpause()

Resume playback of the sound. Playback resumes at the point that the audio was paused
Source: