ALseterrorhandler(3dm) ALseterrorhandler(3dm)
ALseterrorhandler - (obsolete) establish an alternate audio error
handling routine
#include <dmedia/audio.h>
ALerrfunc ALseterrorhandler(ALerrfunc efunc) [Toc] [Back]
efunc expects a pointer to an error handling routine declared as
void errorfunc(long, const char*, ...)
ALseterrorhandler is obsolete and is provided for backward compatibility.
The preferred function is alSetErrorHandler(3dm). Note that the default
error handler is now none; you must call alSetErrorHandler to establish
one.
The Audio Library provides a default error handling routine which prints
diagnostic messages whenever an error occurs in a library call.
ALseterrorhandler(3dm) allows you to override the default error handling
routine.
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 error handling routine.
Setting efunc to 0 prevents any error handling routine from being called;
in this case, the application should check for errors by examining the AL
function return values. Unless printed warnings are desired, we
recommend disabling the error handling function and testing for errors
within the application.
#include <dmedia/audio.h>
ALerrfunc originalErrorHandler;
...
originalErrorHandler = ALseterrorhandler(0);
/* AL errors here will go unnoticed */
...
ALseterrorhandler(originalErrorHandler);
/* back to normal reporting of AL errors */
...
Page 1
ALseterrorhandler(3dm) ALseterrorhandler(3dm)
stdarg(5)
alSetErrorHandler(3dm) alSetErrorHandler(3dm)
alSetErrorHandler - establish an alternate audio error handling routine
#include <dmedia/audio.h>
ALerrfunc alSetErrorHandler(ALerrfunc efunc) [Toc] [Back]
efunc expects a pointer to an error handling routine declared as
void errorfunc(int, const char*, ...)
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.
#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 */
...
}
stdarg(5)
PPPPaaaaggggeeee 2222 [ Back ]
|