smallplay.pas 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. program smallplay;
  2. {****************************************
  3. PT-Player 2.0 © 1994 BetaSoft
  4. uses PTReplay.library also by BetaSoft
  5. and Andreas [Pucko] Pålsson
  6. ****************************************}
  7. uses exec, amigados, ptreplay;
  8. const
  9. vstr : pchar = '$VER: SmallPlay 2.0 (23.12.93)';
  10. var
  11. module : pModule;
  12. SigBit : shortint;
  13. SigMask : longint;
  14. procedure CleanUp(why : string; err : integer);
  15. begin
  16. if why <> '' then writeln(why);
  17. halt(err);
  18. end;
  19. begin
  20. if not Assigned(PTReplayBase) then
  21. begin
  22. writeln('cannot open ' + PTREPLAYNAME);
  23. Halt(5);
  24. end;
  25. module := nil;
  26. if ParamCount > 1 then
  27. CleanUp('Specify one module only',20);
  28. if ParamCount < 0 then
  29. CleanUp('Play what module?',20);
  30. module := PTLoadModule(ParamStr(1));
  31. if not assigned(module) then
  32. CleanUp('Couldn''t open/load module',20);
  33. SigBit := AllocSignal(-1);
  34. if SigBit = -1 then
  35. CleanUp('Couldn''t allocate signal',10);
  36. PTInstallBits(module,SigBit,-1,-1,-1);
  37. PTPlay(module);
  38. SigMask := Wait(SIGBREAKF_CTRL_C or (1 shl SigBit));
  39. if (SigMask and SIGBREAKF_CTRL_C) <> 0 then
  40. PTFade(module,1)
  41. else
  42. PTStop(module);
  43. FreeSignal(SigBit);
  44. PTUnloadModule(module);
  45. end.