RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

Increase OpenAL source limit to 512, adjustable by CVar

Open snowsignal opened this issue 2 years ago • 10 comments

Fixes https://github.com/space-wizards/RobustToolbox/issues/2388

When creating the OpenAL context, we now hint that we may create up to 512 audio sources at once (512 was chose because it was double the previous limit, which already took a lot of effort to hit). This also has the nice benefit of making audio sources faster to allocate and use.

snowsignal avatar Mar 24 '22 05:03 snowsignal

Does the same thing happen at 512? If so probably better to make it a cvar and allow other games to override it.

metalgearsloth avatar Mar 24 '22 08:03 metalgearsloth

We don't ship our own OpenAL on macOS, instead using the system one. Does this work on that? I know macOS' has a much lower limit than OpenAL Soft.

PJB3005 avatar Mar 24 '22 08:03 PJB3005

Just looked, MacOS is hardcapped at 256.

moonheart08 avatar Mar 24 '22 16:03 moonheart08

so if this is made a CVar we should introduce some way to report back if it was actually set to that value or if it has hit some kind of cap. This would introduce a method of fingerprinting the OS, though.

moonheart08 avatar Mar 24 '22 17:03 moonheart08

so if this is made a CVar we should introduce some way to report back if it was actually set to that value or if it has hit some kind of cap. This would introduce a method of fingerprinting the OS, though.

Wouldn't OpenAL just fail if we try to set a number of sources larger than what it can support?

snowsignal avatar Mar 25 '22 01:03 snowsignal

@metalgearsloth @PJB3005 @moonheart08 I made the requested changes - source limits can be set through the audio.sourceMaximum CVar and we will log a warning if the limit was unable to be set.

snowsignal avatar Mar 25 '22 01:03 snowsignal

Does OpenAL soft and macOS just set a lower limit if you try to go too high, or does it fail to create the device in the first place? I can check tonight I guess if necessary.

PJB3005 avatar Mar 25 '22 10:03 PJB3005

Does OpenAL soft and macOS just set a lower limit if you try to go too high, or does it fail to create the device in the first place? I can check tonight I guess if necessary.

I'm not sure. Unfortunately, I don't have a suitable way to test this.

snowsignal avatar Mar 26 '22 23:03 snowsignal

@PJB3005

I can check tonight I guess if necessary.

Sad...

metalgearsloth avatar May 05 '22 09:05 metalgearsloth

From testing: Attempts to query the context attributes all give fuckall for some reason, meaning we can't find out the real sources count. It doesn't actually crash or anything though so 🤷.

I still think this PR is a bad idea though because 256 is already a ridiculous amount of audio sources and the real fix is to fix our shitty audio engine to do some basic prioritization.

PJB3005 avatar Aug 12 '22 11:08 PJB3005