alSetErrorHandler(3dm)alSetErrorHandler(3dm)NAMEalSetErrorHandler - establish an alternate audio error handling routine
SYNOPSIS
#include <dmedia/audio.h>
ALerrfunc alSetErrorHandler(ALerrfunc efunc)
PARAMETER
efunc expects a pointer to an error handling routine declared as
void errorfunc(int, const char*, ...)
DESCRIPTION
By default, the Audio Library handles errors silently, returning a
failure code to the caller. alSetErrorHandler(3dm) allows you to install
an error handling routine which is called in the event of an error in an
Audio Library call. This error handler can be a function in the
application or a default error handler provided by the AL.
Two special values are accepted for efunc. If efunc is 0, errors are
handled silently and no error handler is called. This is the default
behavior. If efunc is AL_PRINT_ERRORS, the AL installs a simple internal
error handler which prints a message to stderr. This was the default
behavior in older versions of the AL. If efunc is neither of these
values, it is assumed to be a pointer to a function provided by the
caller.
The arguments that are passed to the error handling routine are an error
code and a printf-like string perhaps followed with printf-like
arguments.
The returned value is a pointer to the previous value of efunc.
EXAMPLE
#include <dmedia/audio.h>
static void
myerror(int code, const char* fmt, ...)
{
/* do something with code */
}
void example()
{
ALerrfunc originalErrorHandler;
...
/* set up myerror as the error handler */
originalErrorHandler = alSetErrorHandler(myerror);
/* do some audio stuff here */
Page 1
alSetErrorHandler(3dm)alSetErrorHandler(3dm)alSetErrorHandler(originalErrorHandler);
/* back to normal behavior: errors are ignored */
...
}
SEE ALSOstdarg(5)
Page 2