@jakguru/vueprint / @jakguru/vueprint/services/ui / SoundsService
Class: SoundsService
@jakguru/vueprint/services/ui.SoundsService
The SoundsService manages the sounds which are available by exposing the SoundsService.add method, and allows sounds to be played using the SoundsService.play method.
Constructors
constructor
• new SoundsService(sounds?
): SoundsService
Creates a new SoundsService
Parameters
Name | Type | Description |
---|---|---|
sounds? | Record <string , string > | A map of sound names to their urls |
Returns
Defined in
Methods
add
▸ add(sounds
): void
Adds sounds to the service
Parameters
Name | Type | Description |
---|---|---|
sounds | Record <string , string > | A map of sound names to their urls |
Returns
void
Defined in
all
▸ all(): Object
Returns all the Tone.Player objects for all sounds
Returns
Object
Defined in
get
▸ get(key
): Player
Gets a sound from the service
Parameters
Name | Type | Description |
---|---|---|
key | string | The key of the sound to retrieve |
Returns
Player
The Tone.Player object for the sound
Defined in
list
▸ list(): string
[]
Lists the available sound keys
Returns
string
[]
A list of the available sound keys
Defined in
play
▸ play(key
): void
Plays a sound
Parameters
Name | Type | Description |
---|---|---|
key | string | The key of the sound to play |
Returns
void
Defined in
stop
▸ stop(key
): void
Stops a sound
Parameters
Name | Type | Description |
---|---|---|
key | string | The key of the sound to stop |
Returns
void