Constructor
new AudioClipPlayer(options)
- Source:
Parameters:
Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
Properties
|
Extends
Methods
(static) accept(psychoJS, value) → {Object|boolean}
- Source:
Determine whether this player can play the given sound.
Parameters:
Name | Type | Description |
---|---|---|
psychoJS |
module:core.PsychoJS | the PsychoJS instance |
value |
string | the sound value, which should be the name of an audio resource file |
Returns:
argument needed to instantiate a AudioClipPlayer that can play the given sound or false otherwise
- Type
- Object | boolean
getDuration() → {number}
- Source:
- Overrides:
Get the duration of the AudioClip, in seconds.
Returns:
the duration of the clip, in seconds
- Type
- number
play(loops, fadeDurationopt)
- Source:
- Overrides:
Start playing the sound.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
loops |
number | how many times to repeat the track after it has played once. If loops == -1, the track will repeat indefinitely until stopped. |
||
fadeDuration |
number |
<optional> |
17
|
how long should the fading in last in ms |
setAudioClip()
- Source:
Set the audio clip.
Parameters:
Name | Type | Description |
---|---|---|
options.audioClip |
Object | the module:sound.AudioClip. |
setDuration(duration_s)
- Source:
- Overrides:
Set the duration of the audio clip.
Parameters:
Name | Type | Description |
---|---|---|
duration_s |
number | the duration of the clip in seconds |
setLoops(loops)
- Source:
- Overrides:
Set the number of loops.
Parameters:
Name | Type | Description |
---|---|---|
loops |
number | how many times to repeat the clip after it has played once. If loops == -1, the clip will repeat indefinitely until stopped. |
setVolume(volume, muteopt)
- Source:
- Overrides:
Set the volume of the playback.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
volume |
number | the volume of the playback (must be between 0.0 and 1.0) |
||
mute |
boolean |
<optional> |
false
|
whether or not to mute the playback |
stop(fadeDurationopt)
- Source:
- Overrides:
Stop playing the sound immediately.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
fadeDuration |
number |
<optional> |
17
|
how long the fading out should last, in ms |