/************************************************************************/
/* Inter-process Message Definitions	(Accessory version only)	*/
/*									*/
/*	Playback has two 'pipe' commands: HELLO and PLAY.		*/
/*									*/
/*	HELLO simply echos the message back to the sender.  Its purpose */
/*	is to allow the sender to verify that it is really talking to	*/
/*	the PlayBack accessory.	 Must contain the correct magic number	*/
/*	in the request otherwise the message is ignored.		*/
/*									*/
/*	PLAYREQ requests PlayBack to play back a sample. The command	*/
/*	has several paramters:						*/
/*		control - bit fields that control the playback		*/
/*			times  - number of times to repeat playback.	*/
/*				 Range is 0-255 for 1 to 256 times.	*/
/*				 Ignored when control.loop == 1.	*/
/*			freq  - Specifies the playback frequency.	*/
/*				    0 = 5 Khz				*/
/*				    1 = 7.5 Khz				*/
/*				    2 = 10 Khz				*/
/*				    3 = 15 Khz				*/
/*				    4 = 20 Khz				*/
/*				    5 = 31 Khz				*/
/*				    6 = 40 Khz	(external mode only)	*/
/*				    7 = 50 Khz	(external mode only)	*/
/*			unused - reserved for future use (must be 0)	*/
/*			loop   - 1=loop forever; 0=loop for 'times'.	*/
/*			intext - 0=internal playback,1=external (cart.) */
/*									*/
/*		data	is an integer pointer to the sample in memory.	*/
/*			It is up to the sender to load the sample	*/
/*			into memory.					*/
/*									*/
/*		length	is the byte-length of the sample data.		*/
/*									*/
/*	PLAYRSP is the response returned to the PLAYREQ request.	*/
/*	If the error parameter is zero, then the request was honored	*/
/*	and the sample has finished playing.  Otherwise, the request	*/
/*	was rejected, nothing was played, and 'error' contains an 	*/
/*	error code as follows:						*/
/*									*/
/*		-1	The frequency selection was out of range	*/
/*			for internal mode playback.			*/
/*									*/
/*		-2	Reserved bits not zero.				*/
/*									*/
/*	All PlayBack pipe commands are 16 bytes in length.		*/
/************************************************************************/

#define HELLO_CMD	0x0101		/* msgcode for HELLO */
#define PLAY_CMD	0x0102		/* msgcode for PLAY  */

#define HELLO_REQUEST	0x31415927L	/* Send this in HELLO request */
#define HELLO_REPLY	0x72951413L	/* PlayBack replies with this */

typedef struct
	{
	int	msgcode;
	int	sender_id;
	int	unused;		/* Must be Zero */
	} IPMHDR;

typedef struct		/* Hello command request/response definition */
	{
	IPMHDR	hdr;
	long	magic;
	int	unused[3];
	} HELLO;

typedef struct			/* Play command request definition */
	{
	IPMHDR	hdr;
	struct			/* Note: Megamax bit assignment may not */
		{		/*	 be the same as other compilers.*/
		unsigned times:8;  	   /* Number of times to repeat */
		unsigned freq:3;		/* Playback speed (0-7) */
		unsigned unused:3;			/* Must be Zero */
		unsigned loop:1;	/* If True,repeat until stopped */
		unsigned intext:1;	   /* 0=monitor, 1=Replay cart. */
		}control;	/* Playback controls */
	int	*data;		/* pointer to sample data */
	long	length;		/* length of sample */
	} PLAYREQ;

typedef struct			/* Play command response definition*/
	{
	IPMHDR	hdr;
	int	error;		/* 0 if no error, else error code */
	int	unused[4];
	} PLAYRSP;
