
/* PChannel.h - Header file for 'PSyn' resource */

/* Copyright © 1991 by Frank Seide, Koolbarg 39d, D-2000 Hamburg 74, Germany */

#ifndef __PCHANNEL__
#define __PCHANNEL__

#ifndef __SOUND__
#include "sound.h"
#endif

typedef struct PChannel {

	/* Public part: */

	long unused0;
	void (*userInit)();		/* Routine to (re-) init the SoundTrack interpreter */
	int (*userPlay) (struct SoundTrack * soundTrack);	/* Perform one music step */
	void (*userCompletion)();
	long unused1;
	void * userData;		/* Handle for SoundTrack interpreter */
	Boolean playing;		/* Still playing ? (Use StopPChannel() to change) */
	Boolean antiAlias;		/* Real time anti-aliasing on ? (May be changed always) */
	Boolean stereo;		/* Stereo ? (Read only; use StereoPChannel() to change) */
	Byte silence;
	Byte echoFactor;
	Boolean fadeOut;		/* Use StopPChannel (pc, TRUE) to fade out */
	Byte unused2;
	Fixed softFreq;			/* Reference sampling frequency used in calculations */
	Fixed hardFreq;			/* Real sampling frequency (don«t change while playing!) */
	long unused3;			/* (Do not use frequency values greater than $7fff.ffff!) */
	Fixed mainVolume;		/* Main volume (use PChannelVolume() to change) */
	int clipped;				/* Number of sample that had to be clipped */
	int unused4;
	Boolean userInited;	/* user	Init() already called ? (Use ResetPChannel() to clear) */
	Boolean ossiBufEmpty;	/* Monitor buffer empty (Set by user, cleared by IRQ code) */
	int ossiBufSize;		/* Size of monitor buffer (0, if none) */
	Byte * ossiBuffer;		/* Pointer to monitor buffer (NULL, if none) */
	
	/* Private part follows here: */
	
} PChannel;

#define pr_SIZEOF 0xa0

/* Function prototypes: */

extern pascal Boolean CheckPChannel (struct PChannel * pc);
extern pascal void StopPChannel (struct PChannel * pc, Boolean fadeOut);
extern pascal void ClosePChannel (struct PChannel * pc);
extern pascal void ResetPChannel (struct PChannel * pc);
extern pascal OSErr OpenPChannel (int channels, Boolean stereo, int playFrames, struct PChannel ** pcp);
extern pascal OSErr StartPChannel (struct PChannel * pc);
extern pascal OSErr StereoPChannel (register struct PChannel * pc, Boolean stereo);
extern pascal void PChannelVolume (struct PChannel * pc, int chan, Fixed volume);
extern pascal int PChannelVersion();

#endif __PCHANNEL__