| OpenAL Specification and Reference | ||
|---|---|---|
| <<< Previous | OpenAL Operation | Next >>> |
The AL detects only a subset of those conditionsd that could be considered errors. This is because in many cases error checking would adversely impact the performance of an error-free program. The command
enum GetError (void);
To allow for distributed implementations there may be several flag/code pairs. In this case, after a call to GetError returns a value other than NO_ERROR each subsequent call returns the non-NO_ERROR code of another distinct flag-code pair (in unspecified order), until all NO_ERROR codes have been returned. When there are no more non-NO_ERROR codes, all flags be reset. The initial state pf all flags is cleared and the initial value of all codes is NO_ERROR.
![]() | Annotation/ Looping GetError |
|---|---|
OpenAL applications are advised to loop calls of GetError to make sure that all flags are reset. Only the first error occurence for each flag/code pair is recorded, subsequent errors are ignored. The result of a repeated GetError call is not a stack trace or LIFO sequence. All error handling is context specific. |
![]() | Annotation/ Only First Error |
|---|---|
Like OpenGL OpenAL will ignore subsequent errors once an error conditation ahs been encountered. Should the OpenGL specification be updated in this regard, then the OpenAL specification will be amended accordingly. |
![]() | Annotation/ Confusing Language |
|---|---|
The language used here (and elsewhere) might be unfamiliar, but is taken verbatim from the OpenGL specification. |
Error codes can be mapped to strings. The GetString function returns a pointer to a constant (literal) string that is identical to the identifier used for the enumeration value, as defined in the specification.
![]() | Annotation/ Verbose Error String |
|---|---|
There is no need to maintain a separate GetErrorString function (inspired by the proposed gluGetErrorStrings) as the existing GetString entry point can be used. |
Table 2. Error Conditions
| Name | Description |
|---|---|
| NO_ERROR | "No Error" token. |
| INVALID_NAME | Invalid Name parameter. |
| INVALID_ENUM | Invalid parameter. |
| INVALID_VALUE | Invalid enum parameter value. |
| INVALID_OPERATION | Illegal call. |
| OUT_OF_MEMORY | Unable to allocate memory. |
Several error generation conditions are implicit in the description of the various AL commands. First, if a command that requires an enumerated value is passed a value that is not one of those specified as allowable for that command, the error INVALID_ENUM results. This is the case even iof the argument is a pointer to a value if that value is not allowable for the given command. This will occur whether the value is allowable for other functions, or an invalid integer value.
Integer parameters that are used as names for OpenAL objects such as Buffers, Sources, are checked for validity. If an invalid name parameter is specified in an OpenAL command, an INVALID_NAME error will be generated, and the command is ignored.
If a negative integer is provided where an argument of type sizei is specified, the error INVALID_VALUE results. The same error will result from attempts to set integral and floating point values for attributes exceeding the legal range for these. There is no obligation on the implementation to emit INVALID_VALUE if a NaN or Infinity value is passed in for a float or double argument.
Illegal commands are using a valid target (e.g. name), a valid parameter enum, and/or valid parameter values, in an illegal combination. OpenAL has several such mutually exclusive commands operating on similar objects. One example is treating a streaming buffer as a non-streaming buffer, another is appending data to a non-streaming buffer. OpenAL responds to any such illegal combination with an INVALID_OPERATION error.
If memory is exhausted as a side effect of the execution of an AL command, either on system level or by exhausting the allocated resources at AL's internal disposal, the error OUT_OF_MEMORY may be generated. This can also happen independend of recent commands if OpenAL has to request memory for an internal task and fails to allocate the required memory from the operating system.
Otherwise errors are generated only for conditions that are explicitely described in this specification.
| <<< Previous | Home | Next >>> |
| Basic AL Operation | Up | Controlling AL Execution |