From c7a56f7d6637e7f53142992cbdd3fc1e6d304f23 Mon Sep 17 00:00:00 2001 From: Half-Shot Date: Thu, 5 Dec 2024 11:27:07 +0000 Subject: [PATCH] asyncify --- src/useAudioContext.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/useAudioContext.tsx b/src/useAudioContext.tsx index 61d0d96e..fcc35cdd 100644 --- a/src/useAudioContext.tsx +++ b/src/useAudioContext.tsx @@ -26,7 +26,7 @@ type SoundDefinition = { mp3?: string; ogg: string }; * @param buffer The buffer to play. * @returns A promise that resolves when the sound has finished playing. */ -function playSound( +async function playSound( ctx: AudioContext, buffer: AudioBuffer, volume: number, @@ -100,7 +100,7 @@ interface Props { } interface UseAudioContext { - playSound(soundName: S): void; + playSound(soundName: S): Promise; } /** @@ -166,7 +166,7 @@ export function useAudioContext( return null; } return { - playSound: (name): Promise => { + playSound: async (name): Promise => { if (!audioBuffers[name]) { logger.debug(`Tried to play a sound that wasn't buffered (${name})`); return;