home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio Version 4.94
/
audioversion4.94knowledgemediaresourcelibraryoctober1994.iso
/
amiga
/
utils
/
exp_iv
/
events.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-05-12
|
2KB
|
104 lines
/* events.c */
/* handle about every event */
/*
* $Author: Espie $
* $Date: 91/05/12 19:56:25 $
* $Revision: 1.7 $
* $Log: events.c,v $
* Revision 1.7 91/05/12 19:56:25 Espie
* Minor changes.
*
* Revision 1.6 91/05/12 16:00:19 Espie
* Some new events, and tidying up.
*
* Revision 1.5 91/05/09 17:35:06 Espie
* Support for appwindow.
*
* Revision 1.4 91/05/06 23:36:42 Espie
* New parameters xoffset/yoffset for window setup.
*
* Revision 1.3 91/05/05 19:07:46 Espie
* *** empty log message ***
*
* Revision 1.2 91/05/02 23:27:36 Espie
* Interface and requester are in better terms,
* uses the arp requester till further notice.
*
* Revision 1.1 91/05/02 01:33:08 Espie
* Initial revision
*
*
*/
#include <exec/types.h>
#include <dos/dos.h>
#include <intuition/intuition.h>
#include <custom/cleanup.h>
#include "proto.h"
#include "public_play.h"
LOCAL ULONG windowmask, audiomask, playmask, appmask;
LOCAL BOOL not_yet = TRUE;
struct pub_play *init_events(int pri, int xoffset, int yoffset)
{
struct pub_play *play;
struct Window *window;
audiomask = obtain_audio(pri);
play = obtain_player();
window = init_interface(xoffset, yoffset);
windowmask = 1L << window->UserPort->mp_SigBit;
appmask = init_appwindow(window);
playmask = play->signal;
not_yet = FALSE;
return play;
}
LOCAL void handle_events()
{
handle_interface();
handle_app();
handle_audio();
handle_player();
}
LOCAL void wait_events()
{
ULONG r;
r = Wait(windowmask | audiomask | playmask | appmask);
if (r & windowmask)
handle_interface();
if (r & appmask)
handle_app();
if (r & audiomask)
handle_audio();
if (r & playmask)
handle_player();
}
LOCAL void may_exit()
{
if (safe_unload_song())
clear_abort();
else
_exit(0);
}
void check_abort(void)
{
if (not_yet)
return;
handle_events();
if (did_abort())
may_exit();
}
void wait_abort(void)
{
wait_events();
if (did_abort())
may_exit();
}