openal-soft icon indicating copy to clipboard operation
openal-soft copied to clipboard

AL_MAX_GAIN > 1.0

Open hsdk123 opened this issue 4 years ago • 3 comments

Hi, I was hoping to set the volume of something to more than 1.0 and was wondering how I'd go about this. I notice https://github.com/kcat/openal-soft/issues/55, but wasn't sure what I'd need to do

hsdk123 avatar Feb 06 '21 02:02 hsdk123

First, make sure AL_SOFT_gain_clamp_ex is supported. Then for a given source, set:

alSourcef(source, AL_MAX_GAIN, gain_limit); // The max gain you'll be setting
alSourcef(source, AL_GAIN, gain); // Can be anything, but will be clamped to gain_limit

Just be careful setting the max gain above 1 with 3D sources, especially with non-clamped distance models, as the gain will get that much louder when it gets close.

kcat avatar Feb 06 '21 03:02 kcat

Thanks! How would I check if an extension is supported?

hsdk123 avatar Feb 06 '21 03:02 hsdk123

@hsdk123 here's example code:

if (!alcIsExtensionPresent(alcGetContextsDevice(alcGetCurrentContext()), "EXTENSION_NAME"))
{
    // Extension is not presented, do close routine
}

TheLonerD avatar Feb 24 '21 05:02 TheLonerD