So I am trying to run a basic game using this library to play gunshot sounds. It works great, up until a couple hundred shots when out of no where the audio will get distorted and never end. When this is happening the audio from any other objects no longer functions and I get stuck in random glitch sounds for the rest of the game. Is this something I can fix or is this because of the library?
In case you’re curious the code I made is here (I know it’s not well programmed I am just learning):
this happens when you play too many ( same or different ) “songs”
at the same time,
so i suspect that your check on .isPlaying() is missing??
like here?
if (randomNum == 0)
bulletImpact.play();
else if (randomNum == 1)
bulletImpactTwo.play();
if the “song” is to long, cut it,
and use .loop() instead .play(),
but faster for play one is not possible,
can check how many times you start the .play() ?
with put in a
For short sound effect playbacks that happen many times and may happen simultaneously, these classes are specifically designed for what you are trying to do.