/*
	$VER: UPDPlay.rexx 1.2 (27.11.93)

	Author:
		Michael B�hnisch (billy@uni-paderborn.de)	(mb)
		Matthias Scheler (tron@lyssa.pb.owl.de)		(ms)

	Function:
		Filer  currently is not able to replay IFF 8SVX sound files
		greater  than  the largest available chip memory block.  If
		you  have  the  UPD sound demon running, this script is the
		solution.

		Using  Filer,  simply  double-click  on  the sample file to
		play.

		In version 1.2 of this scripts was claimed that UPD works
		asyncron what is of course not true. This script and UPD
		work completely syncron.

	Requires:
		UPD  (� 1991-1993 Jonas Petersson & Absolut Software, rated
		"freely  distributable  copyrighted",  no  shareware  fee).
		Look for it on AmiNet.

	Call:
		UPDPlay IFFFILE

	Example for "Filer.RC":
		IFFDEF "8SVX","Rexx:UPDPlay.rexx %s"

	History:
		26.07.93	1.0 Initial Release (mb)
		26.11.93	1.1 Review for Filer 3.10 Gamma 2 (mb)
		27.11.93	1.2 solved Deadlock situation (ms)
*/

OPTIONS RESULTS			/* aquire results			*/

PARSE ARG IFFFile

/* -------------------------------------------------------------------- */
/* get source directory name, append "/" if it is not a device name	*/
/* -------------------------------------------------------------------- */

SrcPath = PRAGMA('Directory')

IF RIGHT(SrcPath, 1) = ':' THEN
  FileName = SrcPath || IFFFile
ELSE
  FileName = SrcPath || '/' || IFFFile

/* -------------------------------------------------------------------- */

IF SHOW('P', 'PLAY') THEN DO	/* Is UPD running?			*/
  ADDRESS PLAY FILE FileName	/* make UPD play the file		*/
END
ELSE DO				/* UPD not running, inform user		*/
  SAY 'Error: Cannot play|'||FileName||'|UPD is not running!'
END