Simon game bug in the sound

Simon game bug in the sound
0

#1

Hey guys and gals,

I’ve been hacking away at my Simon game for a few weeks now and this problem has been in the background the whole time.

The initial problem was had with calling the same audio file to play more than one times. It would play the first time and, I suspect, because the second call had been made while the audio file was still being used.

I hacked a “solution” by creating an array of five of the same audio files, so the call for it was being made to a technically separate file and looping through it for each call. The hack worked, kinda.

My current issue, I still get sounds that are skipped when the call for the files in the array are made to the last element of said array.

So, while it is happening less frequently, I am still having audio files that aren’t playing.

I can post the relevant functions if needed. Any ideas?


#2

If I had to guess, you probably have to use .currentTime to reset the audio’s time before playing it again.


#3

Holy crap dude! Thank you, thank you, thank you a thousand times. Ah!!!

I’d imported two different JS libraries in an attempt to get rid of that bug. Your simple comment just kicked their asses. :joy:

I’d kiss you if I could.