(state: ToneStates)
| 96 | type ToneStates = keyof typeof toneUrls; |
| 97 | |
| 98 | export async function playTone(state: ToneStates): Promise<void> { |
| 99 | const playSound = !!store.get('fcc-sound'); |
| 100 | if (playSound && toneUrls[state]) { |
| 101 | const Tone = await import('tone'); |
| 102 | |
| 103 | const player = new Tone.Player(toneUrls[state]).toDestination(); |
| 104 | |
| 105 | const storedVolume = (store.get('soundVolume') as number) ?? 50; |
| 106 | const calculateDecibel = -60 * (1 - storedVolume / 100); |
| 107 | |
| 108 | player.volume.value = calculateDecibel; |
| 109 | |
| 110 | await Tone.loaded(); |
| 111 | player.start(); |
| 112 | } |
| 113 | } |
no outgoing calls
no test coverage detected