Interface: 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.

Source:

Extends

  • PsychObject

Methods

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

Determine whether this player can play the given sound.
Parameters:
Type Description
module:sound.Sound the sound
Source:
Returns:
an instance of the SoundPlayer that can play the sound, or undefined if none could be found
Type
Object | undefined

(abstract) getDuration()

Get the duration of the sound, in seconds.
Source:

(abstract) play(loopsopt)

Start playing the sound.
Parameters:
Name Type Attributes Description
loops boolean <optional>
how many times to repeat the sound after it has played once. If loops == -1, the sound will repeat indefinitely until stopped.
Source:

(abstract) setLoops(loops)

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.
Source:

(abstract) setVolume(volume, muteopt)

Set the volume of the tone.
Parameters:
Name Type Attributes Default Description
volume Integer the volume of the tone
mute booleam <optional>
false whether or not to mute the tone
Source:

(abstract) stop()

Stop playing the sound immediately.
Source: