Skip to content

Commit

Permalink
Fix audio bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
steveruizok committed Jul 10, 2022
1 parent 5f74d5d commit 0f44412
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/game/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export const ALL_WORDS = [
* A mapping of game events to Audio elements used to play sound effects.
* To create a new sound effect, create a new file in public/audio.
*/
export const EVENT_SOUNDS: Partial<Record<typeof GAME_EVENTS[number], HTMLAudioElement>> =
Object.fromEntries(
GAME_EVENTS.map((eventName) => [eventName, new Audio(`audio/${eventName}.mp3`)])
)
export const EVENT_SOUNDS: Record<typeof GAME_EVENTS[number], HTMLAudioElement | null> = {
game_start: null,
game_reset: null,
state_change: null,
input_wrong: null,
input_right: new Audio(`audio/input_right.mp3`),
word_start: null,
word_complete: new Audio(`audio/word_complete.mp3`),
}

1 comment on commit 0f44412

@vercel
Copy link

@vercel vercel bot commented on 0f44412 Jul 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.