[openal] Extending max source gain

Ethan Lee flibitijibibo at flibitijibibo.com
Wed Aug 10 13:50:01 EDT 2016


My only real concern is the possibility of breaking existing behavior 
for older applications. That would only ever apply if AL_MAX_GAIN's 
default was changed, but as long as that remains at 1.0f then we can 
just allow up to FLT_MAX and not affect existing code. Something like an 
alGetFloat(AL_MAX_GAIN_LIMIT_SOFT) would work for us in FNA, though that 
kind of limitation may as well apply to AL_MIN_GAIN too since we're 
thinking about MAX.

-Ethan

On 08/10/2016 12:00 PM, openal-request at openal.org wrote:
> I've had a few requests for this now, and have always been a bit stumped
> by the design decision. Currently, according to the spec, the source's
> AL_GAIN property can be set to anything >= 0, including 2, 4, etc.
> However, sources also have the AL_MAX_GAIN property which clamps the
> source's gain, but can only be set up to 1, meaning a source's gain will
> always be clamped to 1 even though an app can set it to something greater.
>
> Another thing is that the spec says (section 4.1, under AL_GAIN):
> "the implementation is free to clamp the total gain (effective gain
> per-source multiplied by the listener gain) to one to prevent overflow."
> This further makes me wonder why AL_MAX_GAIN is limited to 1, since
> implementations are allowed to implicitly clamp the total as needed anyway.
>
> Currently, it is possible to work around this limitation by increasing
> the listener's AL_GAIN above 1. Since the listener gain is applied after
> clamping, a source's effective gain can be made greater than 1 if the
> implementation doesn't implicitly clamp the total (and if it does, it's
> still as loud as it can be). This workaround is pretty hacky, though.
>
> I'd like to propose the following. Allow AL_MAX_GAIN (and AL_MIN_GAIN,
> since it's a companion property) to be set to values greater than 1.
> Since the implementation can clamp the total anyway, why not FLT_MAX?
>
> Further, it may be useful to have a query (retrieved via alGetFloat and
> friends) to specify the total maximum gain a source may be clamped to by
> the implementation, rather than leaving it as a hidden detail. That way,
> an app can know what limits there are for the combined gains, such that
> increasing it beyond said limit won't make it any louder.




More information about the openal mailing list