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;