home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDG-CT1.DMS / in.adf / CT.run / Macros / Audio_Follows_Video.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-10-09  |  3.6 KB  |  173 lines

  1. /*
  2.                         Control Tower Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1995 Merlin's Software
  5. */
  6.  
  7. signal on error
  8. signal on syntax
  9. Options Results
  10.  
  11. Main:
  12. call OpenStuff()
  13. call Docs()
  14. call Routine()
  15. call CloseStuff()
  16. exit
  17. return
  18.  
  19. GetFile:
  20.     parse Arg Title, Path
  21.     Address FLY_1 SetString Path
  22.     Address FLY_1 GetFileNameNT Title
  23. return result
  24.  
  25.  
  26. GetPath:
  27.     parse Arg Title, Path
  28.     Address FLY_1 SetString Path
  29.     Address FLY_1 GetPathNameNT Title
  30. return result
  31.  
  32. GetText:
  33.     parse Arg Title, Text
  34.     Address FLY_1 SetString Text
  35.     Address FLY_1 GetStringNT Title
  36. return result
  37.  
  38.  
  39. OpenStuff:
  40.     address command "run CT:FLY"
  41.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  42.         address command "wait 1"
  43.         end
  44.     TOASTERLIB="ToasterARexx.port"
  45.     call remlib('ToasterARexx.port')
  46.     call remlib('PROJECT_REXX_PORT')
  47.     call addlib('PROJECT_REXX_PORT' , 0)
  48.     call addlib(TOASTERLIB,0)
  49. return
  50.  
  51. CloseStuff:
  52.     Address FLY_1 Quit
  53.     call remlib('ToasterARexx.port')
  54.     call remlib('PROJECT_REXX_PORT')
  55.     exit
  56. return
  57.  
  58. YesOrNo: procedure
  59.     parse Arg Title,Yes,No
  60.     Address FLY_1 OK_TEXT Yes
  61.     Address FLY_1 CANCEL_TEXT No
  62.     Address FLY_1 AskYesNoNT Title
  63.     if result = "OK" then YesNo = 1
  64.     else YesNo = 0
  65. return YesNo
  66.  
  67. Info: 
  68.     parse Arg Title,Yes
  69.     Address FLY_1 OK_TEXT Yes
  70.     Address FLY_1 FYINT Title
  71. return
  72.  
  73. FindDrive:
  74.     address command "C:Info >RAM:FLY-List"
  75.     call open TempFile,"RAM:FLY-List",R
  76.     do until eof(TempFile)
  77.         line = readln(TempFile)
  78.         parse var line Drive" "Rest
  79.         if Drive = "FA0:" then 
  80.             Volume = word(Rest,7)":"
  81.     end
  82.     call close TempFile
  83.     address command "Delete >NIL: RAM:FLY-List"
  84. return Volume
  85.  
  86.  
  87. GetTextTC:
  88.     parse Arg Title, Text
  89.     Address FLY_1 SetString Text
  90.     Address FLY_1 GetStringNTTC Title
  91. return result
  92.  
  93. GetFileName: procedure  
  94.    ARG CompleteName
  95.    c = lastpos("/",CompleteName)
  96.    if c = 0 then c = lastpos(":",CompleteName)
  97.    return substr(CompleteName, c + 1)
  98.  
  99.  
  100. GetPathName: procedure  
  101.    ARG CompleteName
  102.    c = lastpos(":",CompleteName)
  103.    if c = 0 then c = lastpos(":",CompleteName)
  104.    return left(CompleteName,c)
  105.  
  106. Docs:
  107. Answer = YesOrNo(" Do You Need Instructions?"," YES "," NO ")
  108. if Answer = 0 then return 
  109. Text = "
  110. This Macro will take ALL Video Clips with audio and\
  111. set the starting and ending points of each to fade in\
  112. before and after so the audio follows the video."
  113. Answer = YesOrNo(Text," Continue "," Exit ")
  114. if Answer = 0 then call CloseStuff()
  115.  
  116. return
  117.  
  118.  
  119. Routine:
  120.     TimeCode = GetTextTC("Enter Time Code For Fade","00:00:00:00")
  121.     Address FLY_1 ConvertTC TimeCode
  122.     Fade = result*2
  123.  
  124.     start_loc=croutonspot()
  125.     call croutonpick(LAST)
  126.     project_end=croutonspot()
  127.     call croutonpick(FIRST)
  128.     current_spot=0
  129.     do while (current_spot<project_end+1)
  130.            call croutonpick(current_spot)
  131.            current_spot=current_spot+1
  132.            if croutontype()="CLIP" then do
  133.             Audio = croutongettag(AudioVolume1)
  134.             if Audio > 0 then do
  135.                 VS = croutongettag(ClipStartField)
  136.                 VE = croutongettag(Duration)
  137.                 MAX = croutongettag(RecFields)
  138.                 NEWAS = VS - Fade
  139.                 NEWAE = VE + (Fade*2)
  140.  
  141.                 if NEWAS < 0 then do
  142.                     NEWAS = 0
  143.                     end
  144.                 if NEWAE > MAX then do
  145.                     NEWAE = MAX
  146.                     end
  147.  
  148.                 FadeIn = (VS-NEWAS)/30
  149.                 FadeOut = (NEWAE-VE)/60
  150.  
  151.                 call croutonsettag(AudioStart,NEWAS)
  152.                 call croutonsettag(AudioDuration,NEWAE)
  153.                 call croutonsettag(AudioAttack,FadeIn)
  154.                 call croutonsettag(AudioDecay,FadeOut)
  155.                 end
  156.                   end
  157.            end
  158.  
  159.     call croutonpick(start_loc)
  160.     Address FLY_1 OK_TEXT " OK "
  161.     Address FLY_1 FYINT "All Audio Has Been Adjusted!"
  162. return
  163.  
  164.  
  165.  
  166. syntax:
  167. error:
  168.     Address FLY_1 OK_TEXT " OK "
  169.     Title = "An Error Was Found With This Macro On Line #"SIGL"!"
  170.     Address FLY_1 FYINT Title
  171.     Address FLY_1 Quit
  172. exit
  173.