# JSDoc: Interface: SoundPlayer

# 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:
  - sound/SoundPlayer.js, line 12

### 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:
  - sound/SoundPlayer.js, line 27

##### 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:
  - sound/SoundPlayer.js, line 82

#### (abstract) play(loopsopt)

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.

Source:
  - sound/SoundPlayer.js, line 47

#### (abstract) setDuration()

Set the duration of the sound, in seconds.

Source:
  - sound/SoundPlayer.js, line 99

#### (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:
  - sound/SoundPlayer.js, line 116

#### (abstract) setVolume(volume, muteopt)

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

Source:
  - sound/SoundPlayer.js, line 134

#### (abstract) stop()

Stop playing the sound immediately.

Source:
  - sound/SoundPlayer.js, line 65