home *** CD-ROM | disk | FTP | other *** search
/ Computer Music Interactif 7 / cd.iso / pc / PC / Demos / GroovMak / data1.cab / Program_Executable_Files / Media / grooveM.dxr / 00500.ls < prev    next >
Encoding:
Text File  |  1999-09-17  |  9.4 KB  |  243 lines

  1. on mouseEnter
  2.   if the visible of window "Help" then
  3.     tell window "help"
  4.       go("seq1")
  5.     end tell
  6.   end if
  7. end
  8.  
  9. on mouseLeave
  10.   if the visible of window "Help" then
  11.     tell window "help"
  12.       go("start")
  13.     end tell
  14.   end if
  15. end
  16.  
  17. on mouseDown
  18.   global gPlaySeq, mov
  19.   if not gPlaySeq and not (the visible of window "help") then
  20.     if chars(the name of member the memberNum of sprite the clickOn, 1, 2) <> "gr" then
  21.       if count(markerList) = 25 then
  22.         set mov to 0
  23.         openWin("Message")
  24.         tell window "Message"
  25.           go("8")
  26.         end tell
  27.       else
  28.         set mov to 1
  29.         set the loc of sprite 48 to point(800, 800)
  30.         set the memberNum of sprite 48 to the number of member the memberNum of sprite the clickOn
  31.         set the ink of sprite 48 to 36
  32.         set the visible of sprite the clickOn to 0
  33.         repeat while the mouseDown
  34.           set the locH of sprite 48 to the mouseH
  35.           set the locV of sprite 48 to the mouseV
  36.           updateStage()
  37.         end repeat
  38.       end if
  39.     end if
  40.   end if
  41. end
  42.  
  43. on mouseUp
  44.   global gfirstmarker, glastmarker, gPlaySeq, gCont, gBlue, markerList, mov
  45.   if not gPlaySeq and mov and not (the visible of window "help") then
  46.     set interseca to 0
  47.     repeat with i = 2 to 9
  48.       if sprite 48 intersects sprite(i) then
  49.         set interseca to 1
  50.         exit repeat
  51.       end if
  52.     end repeat
  53.     if interseca and (count(markerList) < 25) then
  54.       set new to "g" & chars(the name of member the memberNum of sprite the clickOn, 2, length(the name of member the memberNum of sprite the clickOn))
  55.       set num to integer(chars(the name of member the memberNum of sprite the clickOn, 2, length(the name of member the memberNum of sprite the clickOn)))
  56.       case the clickOn of
  57.         11:
  58.           set the loc of sprite the clickOn to point(191, 134)
  59.         12:
  60.           set the loc of sprite the clickOn to point(215, 126)
  61.         13:
  62.           set the loc of sprite the clickOn to point(238, 120)
  63.         14:
  64.           set the loc of sprite the clickOn to point(259, 114)
  65.         15:
  66.           set the loc of sprite the clickOn to point(282, 111)
  67.         16:
  68.           set the loc of sprite the clickOn to point(305, 107)
  69.         17:
  70.           set the loc of sprite the clickOn to point(328, 105)
  71.         18:
  72.           set the loc of sprite the clickOn to point(351, 106)
  73.       end case
  74.       set the visible of sprite the clickOn to 1
  75.       if markerList = [] then
  76.         set the memberNum of sprite 2 to the number of member new
  77.         append(markerList, num)
  78.         set gfirstmarker to 1
  79.         set glastmarker to 1
  80.       else
  81.         if the name of member the memberNum of sprite i = "marker" then
  82.           append(markerList, num)
  83.           set j to 1
  84.           repeat with i = gfirstmarker to 7 + gfirstmarker
  85.             set j to j + 1
  86.             if i > count(markerList) then
  87.               exit repeat
  88.               next repeat
  89.             end if
  90.             set gN to "g" & getAt(markerList, i)
  91.             set the memberNum of sprite j to the number of member gN
  92.             set glastmarker to i
  93.           end repeat
  94.           if the name of member the memberNum of sprite 9 <> "marker" then
  95.             repeat with k = 2 to 8
  96.               set the memberNum of sprite k to the number of member the memberNum of sprite (k + 1)
  97.               updateStage()
  98.             end repeat
  99.             set the memberNum of sprite 9 to the number of member "marker"
  100.             updateStage()
  101.             set gfirstmarker to gfirstmarker + 1
  102.           end if
  103.         else
  104.           addAt(markerList, gfirstmarker + i - 2, num)
  105.           set j to 1
  106.           repeat with i = gfirstmarker to 7 + gfirstmarker
  107.             set j to j + 1
  108.             if i > count(markerList) then
  109.               exit repeat
  110.               next repeat
  111.             end if
  112.             set gN to "g" & getAt(markerList, i)
  113.             set the memberNum of sprite j to the number of member gN
  114.             set glastmarker to i
  115.           end repeat
  116.         end if
  117.       end if
  118.       set the memberNum of sprite 48 to 1000
  119.       updateStage()
  120.       if markerList <> [] then
  121.         put EMPTY into field "fieldMarkerSeq"
  122.         repeat with m = 1 to count(markerList)
  123.           put getAt(markerList, m) & " " after field "fieldMarkerSeq"
  124.         end repeat
  125.       end if
  126.       case word 2 of field "fieldDuration" of
  127.         "sec":
  128.           set sec to 1920 * the number of words in field "fieldMarkerSeq" / float(field "fieldBpm")
  129.           set sec to integer(sec)
  130.           set min to sec / 60
  131.           if min = 0 then
  132.             set min to "00"
  133.           end if
  134.           if (min >= 1) and (min <= 9) then
  135.             set min to "0" & min
  136.           end if
  137.           set sec to sec mod 60
  138.           if sec = 0 then
  139.             set sec to "00"
  140.           end if
  141.           if (sec >= 1) and (sec <= 9) then
  142.             set sec to "0" & sec
  143.           end if
  144.           put min & ":" & sec & "  sec" into field "fieldDuration"
  145.         otherwise:
  146.           put 8 * the number of words in field "fieldMarkerSeq" & "  bars" into field "fieldDuration"
  147.       end case
  148.       set the textFont of member "fieldDuration" to "IK10"
  149.       set the foreColor of member "fieldDuration" to gBlue
  150.       set the textFont of member "fieldMarkerSeq" to "Arial"
  151.       set the textSize of member "fieldMarkerSeq" to 10
  152.       set the foreColor of member "fieldMarkerSeq" to 0
  153.     else
  154.       case the clickOn of
  155.         11:
  156.           set the loc of sprite the clickOn to point(191, 134)
  157.         12:
  158.           set the loc of sprite the clickOn to point(215, 126)
  159.         13:
  160.           set the loc of sprite the clickOn to point(238, 120)
  161.         14:
  162.           set the loc of sprite the clickOn to point(259, 114)
  163.         15:
  164.           set the loc of sprite the clickOn to point(282, 111)
  165.         16:
  166.           set the loc of sprite the clickOn to point(305, 107)
  167.         17:
  168.           set the loc of sprite the clickOn to point(328, 105)
  169.         18:
  170.           set the loc of sprite the clickOn to point(351, 106)
  171.       end case
  172.       set the visible of sprite the clickOn to 1
  173.       updateStage()
  174.     end if
  175.   end if
  176.   set the editable of member "fieldBpm" to 0
  177. end
  178.  
  179. on rightMouseUp
  180.   global gGrooveSel, gPlaySeq, gPath, gOnSynth, gBlue, stateTrackList, virTracklIst, volValList, panValList, volPosList, panPosList, audioList
  181.   if not gPlaySeq then
  182.     if chars(the name of member the memberNum of sprite the clickOn, 1, 2) <> "gr" then
  183.       case char 1 of the name of member the memberNum of sprite the clickOn of
  184.         "H":
  185.           set gGrooveSel to 0
  186.           set gN to "g" & chars(the name of member the memberNum of sprite the clickOn, 2, length(the name of member the memberNum of sprite the clickOn))
  187.           set the memberNum of sprite the clickOn to the number of member gN
  188.           IKSynthStop()
  189.           set gOnSynth to 0
  190.           IKStop()
  191.           IKFunction()
  192.           set stateTrackList to ["off", "off", "off", "off", "off", "off", "off", "off"]
  193.           set virTracklIst to [-1, -1, -1, -1, -1, -1, -1, -1]
  194.           set volValList to [28, 28, 28, 28, 28, 28, 28, 28]
  195.           set volPosList to [239, 239, 239, 239, 239, 239, 239, 239]
  196.           set panValList to [64, 64, 64, 64, 64, 64, 64, 64]
  197.           set panPosList to [239, 239, 239, 239, 239, 239, 239, 239]
  198.           put EMPTY into field "fieldState"
  199.         "g":
  200.           if gGrooveSel <> 0 then
  201.             set gN to "g" & gGrooveSel
  202.             repeat with i = 1 to 8
  203.               if chars(the name of member the memberNum of sprite (10 + i), 2, length(the name of member the memberNum of sprite (10 + i))) = string(gGrooveSel) then
  204.                 set the memberNum of sprite (10 + i) to the number of member gN
  205.                 updateStage()
  206.                 exit repeat
  207.               end if
  208.             end repeat
  209.           end if
  210.           set gGrooveSel to integer(chars(the name of member the memberNum of sprite the clickOn, 2, length(the name of member the memberNum of sprite the clickOn)))
  211.           set Hn to "H" & gGrooveSel
  212.           set the memberNum of sprite the clickOn to the number of member Hn
  213.           updateStage()
  214.           repeat with i = 1 to 8
  215.             set audio to word i of line integer(chars(the name of member the memberNum of sprite the clickOn, 2, length(the name of member the memberNum of sprite the clickOn))) of field "grooveMem"
  216.             if (audio <> "0") and getPos(audioList, chars(audio, 13, length(audio))) then
  217.               IKVolumeSync(i, integer(chars(audio, 1, 3)))
  218.               IKPanSync(i, integer(chars(audio, 7, 9)))
  219.               IKPlay(i, getPos(audioList, chars(audio, 13, length(audio))))
  220.               setAt(stateTrackList, i, "on")
  221.               setAt(virTracklIst, i, getPos(audioList, chars(audio, 13, length(audio))))
  222.               setAt(volValList, i, integer(chars(audio, 1, 3)))
  223.               setAt(volPosList, i, integer(chars(audio, 4, 6)))
  224.               setAt(panValList, i, integer(chars(audio, 7, 9)))
  225.               setAt(panPosList, i, integer(chars(audio, 10, 12)))
  226.               next repeat
  227.             end if
  228.             IKPlay(i, -1)
  229.             setAt(stateTrackList, i, "off")
  230.             setAt(virTracklIst, i, -1)
  231.             setAt(volValList, i, 28)
  232.             setAt(volPosList, i, 239)
  233.             setAt(panValList, i, 64)
  234.             setAt(panPosList, i, 239)
  235.           end repeat
  236.           put "GROOVE  PLAYING" into field "fieldState"
  237.           set the textFont of member "fieldState" to "IK10"
  238.           set the foreColor of member "fieldState" to gBlue
  239.       end case
  240.     end if
  241.   end if
  242. end
  243.