Random sounds cause severe lag

I reported this a while ago, but then my account got accidentally deleted, and I’m finally getting around to reposting…

If you call the sound function with just the name to generate a random sound like:

sound(SOUND_JUMP)

Then after 30-35 or so times of calling that, the game will effectively freeze for about a second every time the sound function is called after that. So effectively, you can’t use random sounds at all anymore. I know this used to work fine, but I’m not sure what update broke it. I’ve tried it on an iPad Pro, iPad, and an iPhone, and they all have the same problem, so it’s not the device.

An easy way to reproduce is with the Brickout example game. At around 30 or 35 sounds from the paddle or bricks, you’ll see it start freezing.

@Justin I believe I have this fixed in Codea 3.1 (beta). Would you be willing to try using the beta to reproduce? If so, please DM me the Apple ID email I can invite

Edit: also sorry about accidentally deleting your account previously!

@Simeon Ooh, nice. Looks like you already sent me the invite, so yeah, I’ll try to check it out tonight. Thanks!

@Simeon I think it’s fixed, yay! I tried out the example apps and my own game up to 200 sounds, and I never hit any lag. Thanks so much for the quick fix!