/* $VER: Play16daemon 1.1 (29 JUL 97) ** by Charles Patterson ** http://www.azstarnet.com/~midian/ ** ** Description: Creates an ARexx port called PLAY and allows other ** programs to send it commands then plays sound files ** with Play16 ** ** Requirements: Play16 (available on Aminet) ** ** Instructions: Put this file in your REXX: assign ** add RUN >NIL: rx Play16daemon to your User-startup ** Change PATH for Play16 on your system ** See Play16daemon.readme for detailed instructions on use ** * ---- Path to Play16 ---- */ PATH="PLAY16:Play16" IF ~SHOW('L', "rexxsupport.library") THEN ADDLIB("rexxsupport.library",0,-30,0) OPENPORT("PLAY") DO FOREVER IF WAITPKT("PLAY") THEN DO packet = GETPKT("PLAY") pargs = GETARG(packet) PARSE VAR pargs cmd sound cmd=UPPER(cmd) SELECT WHEN cmd = "EXIT" THEN DO REPLY(packet,0) CLOSEPORT("PLAY") EXIT END WHEN cmd = "FILE" THEN DO ADDRESS COMMAND 'RUN >NIL:' PATH sound REPLY(packet,0) END WHEN cmd = "ID" THEN DO played=0 IF ~OPEN('idfile','s:play.ids','R') THEN DO SAY "Can't find s:play.ids" REPLY(packet,17) END ELSE DO DO WHILE ~EOF('idfile') idline=READLN('idfile') PARSE VAR idline idname soundpath idline IF idname=sound THEN DO ADDRESS COMMAND 'RUN >NIL:' PATH soundpath REPLY(packet,0) played=1 END END IF ~played THEN DO SAY "Requested ID not found" REPLY(packet,18) END CLOSE('idfile') END END OTHERWISE DO SAY "Unknown command" REPLY(packet,10) END END END END