
/* Custom ESVXInfo structure 

	(c) Copyright 1995-2001 Grzegorz Calkowski

	This file is part of SysPic.

	SysPic  is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2, or (at your option)
	any later version.

	Bison is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with Bison; see the file COPYING.  If not, write to
	the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

*/

#ifndef ESVXINFO_H
#define ESVXINFO_H

#include "8svx.h"
#include <devices/audio.h>
#include <dos/dos.h>

#define MAXOCT 16

struct ESVXInfo
{
	/* file handle */
	BPTR fh;
   struct MsgPort *port;
	struct IOAudio *aio, *aio1, *aio2, *aio1_rep, *aio2_rep;
	UBYTE	 devopened;
	

	/* 8SVX */
	Voice8Header	vhdr;		

	BYTE		*sample;
	ULONG		samplebytes;
   BYTE	   stereo;				/* stereo? */

	BYTE		*osamps[MAXOCT];
	ULONG		osizes[MAXOCT];
	BYTE		*rsamps[MAXOCT];
	ULONG		rsizes[MAXOCT];
	ULONG		spcycs[MAXOCT];

   /* workers */
   UBYTE vhdrread;

};

/* Errors */

#define ESVXERR_NOT8SVX			50

/* protos for public funcs */

struct ESVXInfo *ESVX_Alloc(void);
void ESVX_Free(struct ESVXInfo *esvx);
LONG ESVX_InitAudio(struct ESVXInfo *esvx, UBYTE stereo, BYTE prec);
void ESVX_FreeAudio(struct ESVXInfo *esvx);
LONG ESVX_Play(struct ESVXInfo *esvx,	LONG octave, LONG note, WORD volume, UBYTE stereo);
void ESVX_Flush(struct ESVXInfo *esvx);
LONG ESVX_Load(struct ESVXInfo *esvx, UBYTE *filename, BOOL allowraw);
void ESVX_UnLoad(struct ESVXInfo *esvx);
void ESVX_Setup(struct ESVXInfo *esvx, LONG rate, LONG volume);

#endif
