Reputation: 6942
I tried
alBufferf (myChannelId, AL_MAX_GAIN (and AL_GAIN), volumeValue);
and got error 0xA002.
Upvotes: 0
Views: 1697
Reputation: 11652
As Isaac has said, you probably want to be setting gain on your a sources:
alSourcef (sourceID, AL_GAIN, volume)
To avoid recieving mysterious error codes in future, you should get into the habit of polling for errors after calls you think may fail / calls you are trying to debug.
This way, you'd know immediately that "0xA002" is "AL_INVALID_ENUM".
To do this with OpenAL you call "alGetError()" which clears and returns the most recent error;
ALenum ALerror = AL_NO_ERROR;
ALerror = alGetError();
std::cout << getALErrorString(ALerror) << std::endl;
You'll need to write something like this to take an error code and return/print a string
std::string getALErrorString(ALenum err) {
switch(err) {
case AL_NO_ERROR: return std::string("AL_NO_ERROR - (No error)."); break;
case AL_INVALID_NAME: return std::string("AL_INVALID_NAME - Invalid Name paramater passed to AL call."); break;
case AL_INVALID_ENUM: return std::string("AL_INVALID_ENUM - Invalid parameter passed to AL call."); break;
case AL_INVALID_VALUE: return std::string("AL_INVALID_VALUE - Invalid enum parameter value."); break;
case AL_INVALID_OPERATION: return std::string("AL_INVALID_OPERATION"); break;
case AL_OUT_OF_MEMORY: return std::string("AL_OUT_OF_MEMORY"); break;
default: return std::string("AL Unknown Error."); break;
};
}
You can lookup exactly what the error code means for a specific function call in OpenAL Programmer's Guide .
For example, on page 39 you can see AL_INVALID_ENUM on alSourcef means "The specified parameter is not valid".
Upvotes: 1
Reputation: 392
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.
Upvotes: 0