/* DSOUND.H 3.0 (c) 1991 Aaron Wallace

This file provides useful prototypes and constants
for accessing DSOUND.DLL 3.0.  */

/* These are the hardware devices supported: */

#define	DS_INTERNAL	0
#define	DS_SSOURCE	1
#define	DS_SBLASTER	2

/* These constants can be used as the
	defaults to PlaySound */	

#define DSOUND_DEF_FREQ		22000
#define DSOUND_DEF_SAMPSIZE	0
#define DSOUND_DEF_VOLUME	10
#define DSOUND_DEF_SHIFT		4


/* These are the "reserved" delay values
that cause the use of either auto-detection
or timer use.  Note that even if auto-detection
is on (EDelayValue=DS_AUTO in WIN.INI),
GetDelayValue() will return the actual
delay value that was calculated, *not* the
DS_AUTO constant. */

#define DS_TIMER		0
#define DS_INVALID		65534
#define DS_AUTO		65535


/* These define the offsets of the header of 
	the "simple" SOUNDER 1.0 file format. 
	All values are words. */

#define 	SND_SAMPSIZE_OFS	0
#define 	SND_FREQ_OFS		2
#define	SND_VOLUME_OFS		4
#define	SND_SHIFT_OFS		6
#define	SND_SAMPLE_OFS		8


/* These define the offsets of the various
	fields of the Martin Hepperle .SND format,
	as used in his SoundTool application. */

#define	MHSND_MAGIC_OFS	0
#define	MHSND_RES_OFS		6
#define	MHSND_LENGTH_OFS	8
#define	MHSND_START_OFS	12
#define	MHSND_END_OFS		16
#define	MHSND_FREQ_OFS		20
#define	MHSND_SAMPSIZE_OFS	22
#define	MHSND_VOLUME_OFS	24
#define	MHSND_SHIFT_OFS	26
#define	MHSND_NAME_OFS		28
#define	MHSND_SAMPLE_OFS	124


/* This defines the in-memory sound
	format used in LoadSoundFile and PlaySoundImage
	functions.  Note that in allocating memory for
	this structure, it reserves space for only one
	sample byte. */
	 

typedef struct _SNDHeader {
	HANDLE reserved;
	long length;
	long start;
	long end;
	unsigned frequency;
	unsigned sampleSize;
	unsigned volume;
	unsigned shift;
	char name[96];
	char samples[1];
} SNDHeader;

typedef SNDHeader far *LPSNDH;


/* Error codes returned from PlaySoundFile.
	OK indicates no error. */

#define DS_OK  		0
#define DS_FILEERROR	1
#define DS_BADFORMAT	2
#define DS_MEMERROR		3


/* Magic values for the type parameter of
	PlaySoundFile.  DS_GUESS will cause PSF to
	try to guess the file's format, based on the
	filename extension and/or header information. */

#define DS_GUESS 0
#define DS_SND 1
#define DS_MHSND 2
#define DS_SOU 3
#define DS_CANTDETECT 0 

/* These are the function prototypes for all public
functions in DSOUND.DLL. */

int FAR PASCAL PlaySound(char huge *, DWORD, unsigned, unsigned, unsigned, unsigned);
int FAR PASCAL SoundFileType(LPSTR);
int FAR PASCAL PlaySoundImage(GLOBALHANDLE);
int FAR PASCAL PlaySoundResource(HANDLE);
long FAR PASCAL _llread(int, char huge *, long);
long FAR PASCAL _llwrite(int, char huge *, long);
int FAR PASCAL PlaySoundFile(LPSTR, int, unsigned, unsigned, unsigned, unsigned);
GLOBALHANDLE FAR PASCAL LoadSoundImage(LPSTR, int, unsigned, unsigned, unsigned, unsigned);
int FAR PASCAL FindBestDelay();
int FAR PASCAL GetDSoundVersion();
int FAR PASCAL GetDSoundVersionD(int);
void FAR PASCAL SetDelayValue(unsigned);
int FAR PASCAL GetDelayValue();
void FAR PASCAL SetVolume(unsigned);
int FAR PASCAL GetVolume();
int FAR PASCAL GetShiftValue();
void FAR PASCAL SetShiftValue(int);
void FAR PASCAL AboutDSound();
void FAR PASCAL AboutDSoundD(int);
BOOL FAR PASCAL UpdateClock(BOOL);
int FAR PASCAL GetSoundDevice();
void FAR PASCAL SetSoundDevice(int);
int FAR PASCAL GetSoundPort();
void FAR PASCAL SetSoundPort(int);


