home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 19 / AACD19.BIN / AACD / Utilities / Compact / ARexx / Middle-Preview.compact next >
Text File  |  1999-11-14  |  3KB  |  87 lines

  1. /* PREVIEW-Extension, which starts playing in the middle of a track,
  2.    and it plays as long as set in the PREVIEW-gadget. It starts playing
  3.    at the actual playing track (or at track 1, when the player is
  4.    currently stopped). When the user presses STOP while this script is
  5.    running, the script will stop too.
  6.  
  7.    TO-DO: - When a program or a snap is active, the JUMP-command has
  8.             no function, because COMPACT only reacts on it, when no
  9.             program or snap is active.
  10.           - As soon as COMPACT knows a command to switch off PREVIEW in
  11.             ARexx, it should be executed by the script before the main
  12.             routine is handled. The settings of RANDOM and REPEAT (and
  13.             eventually PROGRAM and SNAP) should be noticed by the script.
  14.  
  15.    Copyright 1998-1999 by Ralph Weisel,  V1.1
  16. ------------------------------------------------------------------------*/
  17. ADDRESS 'COMPACT'
  18. OPTIONS RESULTS
  19. OPTIONS FAILAT 11
  20.  
  21. GETPREVIEW 0            /* Prüfen, ob PREVIEW aktiviert ist */
  22. prevon=result
  23. IF prevon=1 THEN EXIT
  24.  
  25. GETPREVIEW 1            /* Anzahl der PREVIEW-Sekunden ermitteln */
  26. prevtime=result
  27.  
  28. NUMTRACKS 0            /* Anzahl der Titel der CD ermitteln */
  29. tracks=result
  30.  
  31. ACTTRACK 0            /* Aktuell spielenden Track ermitteln */
  32. trnr=result
  33. IF trnr=0 THEN trnr=1
  34.  
  35. DO track=trnr TO tracks
  36.   TRACKSTART track        /* Startposition eines Titels ermitteln */
  37.   startmin=WORD(result,1)
  38.   startsek=WORD(result,2)
  39.   startseks=startmin*60+startsek
  40.  
  41.   TRACKTIME 3 track        /* Spielzeit eines Titels ermitteln */
  42.   min=WORD(result,1)
  43.   sek=WORD(result,2)
  44.   seks=min*60+sek
  45.   mitte=TRUNC(seks/2)
  46.  
  47.   IF (mitte+prevtime)>seks THEN        /* mitte und prevtime ggf. korr. */
  48.   DO
  49.     IF prevtime>seks THEN
  50.       DO
  51.         prevtime=seks
  52.         mitte=0
  53.       END
  54.     ELSE
  55.       mitte=seks-prevtime
  56.   END
  57.  
  58.   beginnseks=startseks+mitte        /* PLAY-Startpos. errechnen */
  59.   beginnmin=TRUNC(beginnseks/60)
  60.   beginnsek=beginnseks-(beginnmin*60)
  61.  
  62.   endeseks=startseks+mitte+prevtime    /* STOP-Startpos. errechnen */
  63.   endemin=TRUNC(endeseks/60)
  64.   endesek=endeseks-(endemin*60)
  65.  
  66.   IF beginnmin<10 THEN            /* ZU SPIELEN ANFANGEN */
  67.     JUMP '0'||beginnmin||':'||beginnsek
  68.   ELSE
  69.     JUMP beginnmin||':'||beginnsek
  70.  
  71.  
  72.   address command 'WAIT '||prevtime    /* Benötigt Befehl WAIT in C: !! */
  73.   ACTTRACK 0
  74.   IF result=0 THEN LEAVE track        /* Wenn STOP, dann Skript-Ende */
  75.  
  76. /*-------- First WAIT-version, which needs many CPU-time: ----------
  77.   DO zeit=time('R') WHILE zeit<prevtime        /* Auf nächsten Titel warten */
  78.     zeit=time('E')
  79.     ACTTRACK 0
  80.     IF result=0 THEN LEAVE track    /* Wenn STOP, dann Skript-Ende */
  81.   END
  82. ---------------------------------------------------------------------------*/
  83.  
  84. END
  85. STOP                    /* CD-Player stoppen */
  86. EXIT
  87.