alCheckEvent(3dm) alCheckEvent(3dm)
alCheckEvent - Looks for an event in the event queue and retrieves it.
#include <dmedia/audio.h>
int alCheckEvent(ALeventQueue eventq,int src,int param,ALevent event)
eventq expects an ALeventQueue structure from which you want to
retrieve audio events.
src expects an int with the value of the resource that generated or
posted the audio event.
param expects an int with the value of the parameter for the audio
event.
event expects an ALevent structure previously initialized by
alNewEvent(3dm).
alCheckEvent(3dm) retrieves the next ALevent struct in eventq that
matches its fields with param and src and places it on event. This call
will not block if the event is not found, or the event queue is empty.
Note that src refers to the resource that generated or posted the event,
please refer to alSelectEvents(3dm) and alParams(3dm) for more
information.
To process the event, use the following calls: alGetEventParam(3dm),
alGetEventUST(3dm), alGetEventValue(3dm), alGetEventData(3dm),
alGetEventResource(3dm), and alGetEventSrcResource(3dm).
The following examples tries to retrieve an event from an event queue
through alCheckEvent(3dm). The event should have an AL_GAIN parameter
and the its resource should be the AL_DEFAULT_INPUT.
int param;
ALevent event;
/*
* Initialize an ALevent structure.
*/
event = alNewEvent();
if(event == NULL) {
fprintf(stderr,"Event allocation failed: %s",
alGetErrorString(oserror()));
exit(-1);
}
Page 1
alCheckEvent(3dm) alCheckEvent(3dm)
/*
* Check for the event
*/
param = AL_GAIN;
resource = AL_DEFAULT_INPUT;
status = alCheckEvent(eventq,param,resource,event);
if(status == -1) {
fprintf(stderr,"Event was not found: %s",
alGetErrorString(oserror()));
exit(-1);
}
Upon successful completion, alCheckEvent returns 0.
Otherwise, alCheckEvent returns -1 and sets an error number which can be
retrieved with oserror(3C).
alCheckEvent can fail for the following reason:
AL_BAD_INVALID_EVENTQ eventq is either invalid or null.
AL_BAD_INVALID_EVENT event is either invalid or null.
AL_BAD_EVENT_NOT_FOUND An event match was not found in eventq.
alOpenEventQueue(3dm), alSelectEvents(2), alGetEventParam(3dm),
alGetEventUST(3dm), alGetEventValue(3dm), alGetEventData(3dm),
alGetEventResource(3dm), alGetEventSrcResource(3dm), alParams(3dm),
oserror(3C)
PPPPaaaaggggeeee 2222 [ Back ]
|