/* globals.c */

struct  IOAudio 	openIOB;      /* IOB to open and close the device */
struct  MsgPort 	*auReplyPort; /* temporary pointer */
struct  MsgPort 	*controlPort; /* Port for ControlChannel functions */

char    *globalname 	= "global";	/* the name for global IOB's  */
char    *dynamicname 	= "dynamic";	/* the name for dynamic IOB's */

UBYTE stereostuff[4] 	= { 3, 5, 10, 12 };	/* channel masks for stereo */
UBYTE anychan[4] 	= { 1, 2, 4, 8 };	/* channel masks for mono */

/* Resolve all externals */

struct ExtIOB	  	audbuffer[AUDBUFFERS];	/* globals to build-in       */
UBYTE 			*chipaudio[4];	/* pointers to waveforms in CHIP RAM */
struct Unit 		*unit[4];	/* global pointers to Units        */
struct Device 		*device;	/* global pointer to audio device  */
LONG 			datalength[4];	/* length of the data for a wave   */
struct MsgPort 		*replyPort[4];  /* one ReplyPort per channel       */
BYTE 			inuse[AUDBUFFERS]; /* keep track of globals in-use */
WORD 			key[4];		/* global value for alloc keys     */
struct Unit		*gotunit;	/* returned unit value             */
WORD 		 	gotkey;		/* returned allocation key         */
LONG			dynamix[4];	/* counters for how many
					 * dynamically allocated audio
					 * message I/O blocks 
					 */

/* Each waveform buffer contains 8 octaves of the wave.  
 * The offset values specify where in the buffer the
 * proper waveform table for that octave begins.
 */
int woffsets[] 	= { 0, 256, 384, 448, 480, 496, 504, 508, 510 };

/* Length of each waveform within a buffer */
int wlen[] 	= { 256, 128, 64, 32, 16, 8, 4, 2, 1 };

/* Period value to go with particular notes within an octave. */
int perval[] 	= { 428, 404, 381, 360, 339, 320, 
     		    302, 285, 269, 254, 240, 226, 214 };

UBYTE *w1, *w2, *w3;
BYTE *owptr[4] 	= { NULL, NULL, NULL, NULL };
