Description
Is your feature request related to a problem? Please describe.
I just discovered that GTA sounds cause a huge FPS drop, thanks to being able to disable them with setWorldSoundEnabled. When I have peds shooting at me, I'd always get low FPS and I always thought it was something like the bullet effects but in fact doing:
for i=0, 44 do setWorldSoundEnabled ( i, false, true ) end
Completely eliminates the FPS drop and the FPS drop is not trivial. It was from ~100 to ~60 with 2 peds shooting at me with M4's. Doing resetWorldSounds() would make the FPS drop again.
Describe the solution you'd like
I've not idea if this is possible but is there some way that the sound system not cause such large FPS drops? And it's not just from shooting, '/showsound' is showing me a constant spam of about 10 sounds per second from players in the area but are so distant that none of the sounds are actually audio-able even at high volume and by disabling sounds my FPS would go from ~80 to ~100 so one solution maybe if any sounds where the volume would be so low the player can't hear them, that they'd be aborted which would at least help quite a bit.
Describe alternatives you've considered
I have tried cancelling sounds with:
addEventHandler("onClientWorldSound", root, function() cancelEvent() end)
To see if that would improve FPS, but it has no effect. So it must be some code before we get to onClientWorldSound that eats FPS. Could it be the reading from disk? If it is, well then the FPS hit would be way worse for other players because I'm using an SSD. Maybe it needs what ccw did for the CJ clothes, a cache of most commonly played sounds.
Because the FPS drop is so bad I will be adding settings so that players have certain spammy sounds disabled when their FPS drops below a certain range that they can adjust. I'm also going to find out what sounds are created most (I'll add the code to an example in onClientWorldSound) because there might be just a few sounds that are played so much they destroy FPS, like foot steps.
Additional context
I was just thinking, @saml1er found that the biggest FPS problem of all was something like "DX draw call state changes" but I'm guessing that test was done with no players running and driving around because must a debug build (and therefore no players making noises) be used for that analysis?