Question

I'm using this line of code to set gain of sound source. I want to increase volume of sound to be loud, (like alarm in iOS), but if I try to set gain greater than 1.0 it doesn't effect.

In documentation it's said

/**
 * Indicate the gain (volume amplification) applied. 
 * Type:   ALfloat.
 * Range:  ]0.0-  ]
 * A value of 1.0 means un-attenuated/unchanged.
 * Each division by 2 equals an attenuation of -6dB.
 * Each multiplicaton with 2 equals an amplification of +6dB.
 * A value of 0.0 is meaningless with respect to a logarithmic
 *  scale; it is interpreted as zero volume - the channel
 *  is effectively disabled.
 */
#define AL_GAIN                                   0x100A

alSourcef(source, AL_GAIN, 4.0f);//Set gain/volume  - 4.0f sounds the same as 1.0f gain

Am I doing something wrong? If gain won't work, is there any other way to increase volume of sound. Thanks

Was it helpful?

Solution

A value of 1.0 means un-attenuated/unchanged. Thus, values above 1.0f are treated the same as 1.0f.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top