openal-soft
openal-soft copied to clipboard
AL_MAX_GAIN > 1.0
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
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.
Thanks! How would I check if an extension is supported?
@hsdk123 here's example code:
if (!alcIsExtensionPresent(alcGetContextsDevice(alcGetCurrentContext()), "EXTENSION_NAME"))
{
// Extension is not presented, do close routine
}