SoundPlayer

sound SoundPlayer

SoundPlayer is an interface for the sound players, who are responsible for actually playing the sounds, i.e. the tracks or the tones.

Extends

  • PsychObject

Methods

(abstract, static) accept(sound) → {Object|undefined}

Source:

Determine whether this player can play the given sound.

Parameters:
Name Type Description
sound module:sound.Sound

the sound

Returns:

an instance of the SoundPlayer that can play the sound, or undefined if none could be found

Type
Object | undefined

(abstract) getDuration()

Source:

Get the duration of the sound, in seconds.

(abstract) play(loopsopt)

Source:

Start playing the sound.

Parameters:
Name Type Attributes Description
loops number <optional>

how many times to repeat the sound after it has played once. If loops == -1, the sound will repeat indefinitely until stopped.

(abstract) setDuration()

Source:

Set the duration of the sound, in seconds.

(abstract) setLoops(loops)

Source:

Set the number of loops.

Parameters:
Name Type Description
loops number

how many times to repeat the sound after it has played once. If loops == -1, the sound will repeat indefinitely until stopped.

(abstract) setVolume(volume, muteopt)

Source:

Set the volume of the tone.

Parameters:
Name Type Attributes Default Description
volume Integer

the volume of the tone

mute boolean <optional>
false

whether or not to mute the tone

(abstract) stop()

Source:

Stop playing the sound immediately.