Skip to content

@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

NameTypeDescription
sounds?Record<string, string>A map of sound names to their urls

Returns

SoundsService

Defined in

src/services/ui.ts:246

Methods

add

add(sounds): void

Adds sounds to the service

Parameters

NameTypeDescription
soundsRecord<string, string>A map of sound names to their urls

Returns

void

Defined in

src/services/ui.ts:274


all

all(): Object

Returns all the Tone.Player objects for all sounds

Returns

Object

Defined in

src/services/ui.ts:264


get

get(key): Player

Gets a sound from the service

Parameters

NameTypeDescription
keystringThe key of the sound to retrieve

Returns

Player

The Tone.Player object for the sound

Defined in

src/services/ui.ts:291


list

list(): string[]

Lists the available sound keys

Returns

string[]

A list of the available sound keys

Defined in

src/services/ui.ts:257


play

play(key): void

Plays a sound

Parameters

NameTypeDescription
keystringThe key of the sound to play

Returns

void

Defined in

src/services/ui.ts:299


stop

stop(key): void

Stops a sound

Parameters

NameTypeDescription
keystringThe key of the sound to stop

Returns

void

Defined in

src/services/ui.ts:311

Vueprint is a commercial work product released under the MIT License and is provided as-is with no warranty or guarantee of support.