MCPcopy
hub / github.com/gitify-app/gitify / raiseSoundNotification

Function raiseSoundNotification

src/renderer/utils/system/audio.ts:16–37  ·  view source on GitHub ↗
(volume: Percentage)

Source from the content-addressed store, hash-verified

14 * @param volume - The volume level to play the sound at, as a percentage (`0`–`100`).
15 */
16export async function raiseSoundNotification(volume: Percentage) {
17 if (!cachedAudio) {
18 const path = await window.gitify.notificationSoundPath();
19
20 cachedAudio = new Audio(path);
21 }
22
23 const audio = cachedAudio;
24
25 audio.volume = volumePercentageToLevel(volume);
26
27 try {
28 await audio.play();
29 } catch (err) {
30 rendererLogError(
31 'audio',
32 'Failed to play notification sound:',
33 toError(err),
34 );
35 cachedAudio = null;
36 }
37}

Callers 2

audio.test.tsFile · 0.90
useNotificationsFunction · 0.90

Calls 3

volumePercentageToLevelFunction · 0.90
rendererLogErrorFunction · 0.90
toErrorFunction · 0.90

Tested by

no test coverage detected