Search code examples
audiovolumeopenal

How to set channel gain in OpenAL?


I tried

alBufferf (myChannelId, AL_MAX_GAIN (and AL_GAIN), volumeValue);

and got error 0xA002.


Solution

  • 0xA002 is an ILLEGAL ENUM ERROR in linux.

    You got that because it's impossible to modify the gain of a buffer. There's no such thing.

    What you can do is set the AL_GAIN attribute either to the listener (applying it to all sources in the current context) or to a particular source.