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 / 00502.ls < prev    next >
Encoding:
Text File  |  1999-09-17  |  15.9 KB  |  402 lines

  1. on mouseDown
  2.   global gGrooveSel, gfirstmarker, gMix, markerList
  3.   if not (the visible of window "help") then
  4.     if inside(the clickLoc, rect(368, 100, 375, 106)) and (the lineCount of member "grooveMem" > 8) and (the name of member the memberNum of sprite 18 <> ("g" & string(the lineCount of member "grooveMem"))) then
  5.       repeat while the mouseDown
  6.         set the memberNum of sprite 10 to the number of member "HnextGrooveSeq"
  7.         set the ink of sprite 10 to 36
  8.         set the loc of sprite 10 to point(370, 104)
  9.         updateStage()
  10.       end repeat
  11.       pass()
  12.     end if
  13.     if inside(the clickLoc, rect(174, 139, 181, 146)) and (chars(the name of member the memberNum of sprite 11, 2, length(the name of member the memberNum of sprite 11)) <> "1") then
  14.       repeat while the mouseDown
  15.         set the memberNum of sprite 10 to the number of member "HpreviousGrooveSeq"
  16.         set the ink of sprite 10 to 36
  17.         set the loc of sprite 10 to point(175, 143)
  18.         updateStage()
  19.       end repeat
  20.       pass()
  21.     end if
  22.     if inside(the clickLoc, rect(376, 115, 384, 121)) and (char 1 of the name of member the memberNum of sprite 3 <> "a") then
  23.       repeat while the mouseDown
  24.         set the memberNum of sprite 10 to the number of member "HnextMarker"
  25.         set the ink of sprite 10 to 36
  26.         set the loc of sprite 10 to point(378, 120)
  27.         updateStage()
  28.       end repeat
  29.       pass()
  30.     end if
  31.     if inside(the clickLoc, rect(201, 173, 209, 180)) and (gfirstmarker > 1) then
  32.       repeat while the mouseDown
  33.         set the memberNum of sprite 10 to the number of member "HpreviousMarker"
  34.         set the ink of sprite 10 to 36
  35.         set the loc of sprite 10 to point(204, 178)
  36.         updateStage()
  37.       end repeat
  38.       pass()
  39.     end if
  40.     if inside(the clickLoc, rect(175, 326, 192, 343)) and (markerList <> []) and gMix then
  41.       repeat while the mouseDown
  42.         set the memberNum of sprite 10 to the number of member "Hmix"
  43.         set the ink of sprite 10 to 36
  44.         set the loc of sprite 10 to point(182, 335)
  45.         updateStage()
  46.       end repeat
  47.       pass()
  48.     end if
  49.     if inside(the clickLoc, rect(567, 372, 634, 387)) then
  50.       repeat while the mouseDown
  51.         set the memberNum of sprite 10 to the number of member "HsongMenu"
  52.         set the ink of sprite 10 to 36
  53.         set the loc of sprite 10 to point(601, 381)
  54.         updateStage()
  55.       end repeat
  56.       pass()
  57.     end if
  58.     if inside(the clickLoc, rect(567, 393, 634, 408)) then
  59.       repeat while the mouseDown
  60.         set the memberNum of sprite 10 to the number of member "Hgroove"
  61.         set the ink of sprite 10 to 36
  62.         set the loc of sprite 10 to point(601, 401)
  63.         updateStage()
  64.       end repeat
  65.       pass()
  66.     end if
  67.     if inside(the clickLoc, rect(567, 433, 634, 448)) then
  68.       repeat while the mouseDown
  69.         set the memberNum of sprite 10 to the number of member "HvMix"
  70.         set the ink of sprite 10 to 36
  71.         set the loc of sprite 10 to point(601, 441)
  72.         updateStage()
  73.       end repeat
  74.       pass()
  75.     end if
  76.     if inside(the clickLoc, rect(592, 453, 611, 471)) then
  77.       repeat while the mouseDown
  78.         set the memberNum of sprite 10 to the number of member "Hpref"
  79.         set the ink of sprite 10 to 36
  80.         set the loc of sprite 10 to point(602, 464)
  81.         updateStage()
  82.       end repeat
  83.       pass()
  84.     end if
  85.     if inside(the clickLoc, rect(615, 453, 634, 471)) then
  86.       repeat while the mouseDown
  87.         set the memberNum of sprite 10 to the number of member "Hquit"
  88.         set the ink of sprite 10 to 36
  89.         set the loc of sprite 10 to point(625, 464)
  90.         updateStage()
  91.       end repeat
  92.     end if
  93.   end if
  94. end
  95.  
  96. on mouseUp
  97.   global gfirstmarker, glastmarker, gFirstNum, gPlaySeq, gCont, gGrooveSel, gBpmSong, gReturn, gPath, gRandom, gOnSynth, gQMix, gMix, gRed, gBlue, gGreen, markerList, virTracklIst, stateTrackList, volValList, panValList, tapList, audioList, randomizeList
  98.   if not (the visible of window "help") then
  99.     if inside(point(the mouseH, the mouseV), rect(174, 139, 181, 146)) and (chars(the name of member the memberNum of sprite 11, 2, length(the name of member the memberNum of sprite 11)) <> "1") and (the lineCount of member "grooveMem" > 8) then
  100.       if gGrooveSel <> 0 then
  101.         set gN to "g" & gGrooveSel
  102.         repeat with i = 1 to 8
  103.           if char 1 of the name of member the memberNum of sprite (10 + i) = "H" then
  104.             set the memberNum of sprite (10 + i) to the number of member gN
  105.             updateStage()
  106.             exit repeat
  107.           end if
  108.         end repeat
  109.       end if
  110.       set pN to chars(the name of member the memberNum of sprite 18, 2, length(the name of member the memberNum of sprite 18))
  111.       repeat with j = 1 to 8
  112.         set gN to "g" & integer(pN - j)
  113.         set the memberNum of sprite (19 - j) to the number of member gN
  114.       end repeat
  115.       set pNum to integer(chars(the name of member the memberNum of sprite 11, 2, length(the name of member the memberNum of sprite 11)))
  116.       if (pNum <= gGrooveSel) and ((pNum + 7) >= gGrooveSel) then
  117.         set Hn to "H" & gGrooveSel
  118.         set the memberNum of sprite (11 + gGrooveSel - pNum) to the number of member Hn
  119.         updateStage()
  120.       end if
  121.       pass()
  122.     end if
  123.     if inside(point(the mouseH, the mouseV), rect(368, 100, 375, 106)) and (the lineCount of member "grooveMem" > 8) and (integer(chars(the name of member the memberNum of sprite 18, 2, length(the name of member the memberNum of sprite 18))) <> the lineCount of member "grooveMem") then
  124.       if gGrooveSel <> 0 then
  125.         set gN to "g" & gGrooveSel
  126.         repeat with i = 1 to 8
  127.           if char 1 of the name of member the memberNum of sprite (10 + i) = "H" then
  128.             set the memberNum of sprite (10 + i) to the number of member gN
  129.             updateStage()
  130.             exit repeat
  131.           end if
  132.         end repeat
  133.       end if
  134.       set pN to chars(the name of member the memberNum of sprite 11, 2, length(the name of member the memberNum of sprite 11))
  135.       repeat with j = 1 to 8
  136.         set gN to "g" & integer(pN + j)
  137.         set the memberNum of sprite (10 + j) to the number of member gN
  138.       end repeat
  139.       set pNum to integer(chars(the name of member the memberNum of sprite 11, 2, length(the name of member the memberNum of sprite 11)))
  140.       if (pNum <= gGrooveSel) and ((pNum + 7) >= gGrooveSel) then
  141.         set Hn to "H" & gGrooveSel
  142.         set the memberNum of sprite (11 + gGrooveSel - pNum) to the number of member Hn
  143.         updateStage()
  144.       end if
  145.       pass()
  146.     end if
  147.     if inside(point(the mouseH, the mouseV), rect(376, 115, 384, 121)) and (gfirstmarker <> glastmarker) then
  148.       repeat with i = 2 to glastmarker - gfirstmarker + 1
  149.         if ((gfirstmarker + i - 1) <= glastmarker) and ((gfirstmarker + i - 1) <= count(markerList)) then
  150.           set gN to "g" & getAt(markerList, gfirstmarker + i - 1)
  151.           set the memberNum of sprite i to the number of member gN
  152.         else
  153.           exit repeat
  154.         end if
  155.         updateStage()
  156.       end repeat
  157.       set gfirstmarker to gfirstmarker + 1
  158.       if (count(markerList) <= 8) or (glastmarker = count(markerList)) then
  159.         set the memberNum of sprite i to the number of member "marker"
  160.       else
  161.         set glastmarker to glastmarker + 1
  162.         if glastmarker <= count(markerList) then
  163.           set gN to "g" & getAt(markerList, glastmarker)
  164.           set the memberNum of sprite i to the number of member gN
  165.         else
  166.           set glastmarker to glastmarker - 1
  167.           set the memberNum of sprite i to the number of member "marker"
  168.         end if
  169.       end if
  170.       updateStage()
  171.       pass()
  172.     end if
  173.     if inside(point(the mouseH, the mouseV), rect(201, 173, 209, 180)) and (gfirstmarker > 1) then
  174.       repeat with i = glastmarker - gfirstmarker + 1 down to 1
  175.         if (i + 2) <= 9 then
  176.           set the memberNum of sprite (i + 2) to the memberNum of sprite (i + 1)
  177.           updateStage()
  178.         end if
  179.       end repeat
  180.       set gN to "g" & getAt(markerList, gfirstmarker - 1)
  181.       set the memberNum of sprite 2 to the number of member gN
  182.       set gfirstmarker to gfirstmarker - 1
  183.       if (glastmarker - gfirstmarker + 1) > 8 then
  184.         set glastmarker to glastmarker - 1
  185.       end if
  186.       pass()
  187.     end if
  188.     if inside(point(the mouseH, the mouseV), rect(175, 326, 192, 343)) and (markerList <> []) and gMix then
  189.       set durata to count(markerList) * 32 * 60 / float(field "fieldBpm")
  190.       set durata to durata * 44100 * 4
  191.       if not gQMix then
  192.         set numMaxTrack to 0
  193.         repeat with i = 1 to count(markerList)
  194.           set numTrack to 0
  195.           repeat with j = 1 to 8
  196.             set audio to word j of line getAt(markerList, i) of field "grooveMem"
  197.             if (audio <> "0") and getPos(audioList, audio) then
  198.               set numTrack to numTrack + 1
  199.             end if
  200.           end repeat
  201.           set numMaxTrack to max(numMaxTrack, numTrack)
  202.         end repeat
  203.         set durata to durata * numMaxTrack
  204.       end if
  205.       if IKGetFreeDiskSpace(chars(gPath, 1, offset("\", gPath))) < (durata / 1000) then
  206.         openWin("Message")
  207.         tell window "Message"
  208.           go("7")
  209.         end tell
  210.       else
  211.         mix()
  212.       end if
  213.       pass()
  214.     end if
  215.     if inside(point(the mouseH, the mouseV), rect(567, 372, 634, 387)) then
  216.       openWin("YesNo")
  217.       tell window "YesNo"
  218.         go("newSong")
  219.       end tell
  220.       pass()
  221.     end if
  222.     if inside(point(the mouseH, the mouseV), rect(567, 393, 634, 408)) then
  223.       set gFirstNum to chars(the name of member the memberNum of sprite 11, 2, length(the name of member the memberNum of sprite 11))
  224.       repeat with i = 2 to 19
  225.         puppetSprite(i, 0)
  226.       end repeat
  227.       puppetSprite(39, 1)
  228.       set the memberNum of sprite 39 to 1000
  229.       set the loc of sprite 39 to point(320, 240)
  230.       set the foreColor of field "fieldMarkerSeq" to 0
  231.       go("groove")
  232.       set the visible of sprite 20 to 1
  233.       put integer(word 1 of field "fieldBarBeat") into word 1 of field "fieldBarBeat"
  234.       set bpm to float(field "fieldBpm")
  235.       set the locH of sprite 24 to (15 * 25 * (bpm - gBpmSong) / gBpmSong) + 321
  236.       set the locV of sprite 24 to 449
  237.       updateStage()
  238.       IKBeginBlock()
  239.       repeat with i = 1 to 8
  240.         case getAt(stateTrackList, i) of
  241.           "on":
  242.             puppetSprite(40 + i, 1)
  243.             set onT to "on" & i
  244.             set the memberNum of sprite (40 + i) to the number of member onT
  245.             updateStage()
  246.             IKVolume(i, getAt(volValList, i))
  247.             IKPan(i, getAt(panValList, i))
  248.             IKPlay(i, getAt(virTracklIst, i))
  249.         end case
  250.       end repeat
  251.       IKEndBlock()
  252.       if gPlaySeq then
  253.         set gPlaySeq to 0
  254.         set gGrooveSel to integer(word gCont of field "fieldMarkerSeq")
  255.       end if
  256.       if IKGetCurrentBeat() = -1 then
  257.         set gRandom to getAt(randomizeList, random(count(randomizeList)))
  258.         put gRandom into field "fieldRandom"
  259.         set the textFont of member "fieldRandom" to "IK10"
  260.         set the foreColor of member "fieldRandom" to gRed
  261.         playRandom()
  262.       else
  263.         repeat with i = 1 to 8
  264.           if getAt(virTracklIst, i) <> -1 then
  265.             put i into word 1 of line getAt(virTracklIst, i) of field "fieldAudio"
  266.             set the foreColor of word 1 of line getAt(virTracklIst, i) of field "fieldAudio" to gBlue
  267.           end if
  268.         end repeat
  269.       end if
  270.       pass()
  271.     end if
  272.     if inside(point(the mouseH, the mouseV), rect(567, 433, 634, 448)) then
  273.       repeat with i = 2 to 9
  274.         puppetSprite(i, 0)
  275.       end repeat
  276.       repeat with i = 11 to 19
  277.         puppetSprite(i, 0)
  278.       end repeat
  279.       set the foreColor of field "fieldMarkerSeq" to 0
  280.       set gPlaySeq to 0
  281.       if IKGetCurrentBeat() <> -1 then
  282.         if gOnSynth then
  283.           set gOnSynth to 0
  284.           IKSynthStop()
  285.         end if
  286.         IKStop()
  287.         IKFunction()
  288.       end if
  289.       put EMPTY into field "fieldBarBeat"
  290.       go("vMix")
  291.       set the visible of sprite 20 to 1
  292.       put EMPTY into field "fieldDuration"
  293.       set the loc of sprite 39 to point(320, 226)
  294.       set the memberNum of sprite 39 to 1000
  295.       updateStage()
  296.       set bpm to float(field "fieldBpm")
  297.       set the locH of sprite 24 to (15 * 25 * (bpm - gBpmSong) / gBpmSong) + 321
  298.       set the locV of sprite 24 to 341
  299.       updateStage()
  300.       pass()
  301.     end if
  302.     if inside(point(the mouseH, the mouseV), rect(592, 453, 611, 471)) then
  303.       set gReturn to "seq grooveM"
  304.       set the foreColor of member "fieldMarkerSeq" to 0
  305.       put EMPTY into field "fieldState"
  306.       if (markerList <> []) and gPlaySeq then
  307.         if not gGrooveSel then
  308.           set gGrooveSel to getAt(markerList, gCont)
  309.         end if
  310.       end if
  311.       if the visible of window "synth" then
  312.         close(window "synth")
  313.       end if
  314.       set gPlaySeq to 0
  315.       go("start", "pref")
  316.       pass()
  317.     end if
  318.     if inside(point(the mouseH, the mouseV), rect(615, 453, 634, 471)) then
  319.       openWin("YesNo")
  320.       tell window "YesNo"
  321.         go("quit")
  322.       end tell
  323.       pass()
  324.     end if
  325.     if inside(point(the mouseH, the mouseV), rect(489, 407, 523, 442)) then
  326.       set click to the timer
  327.       if getAt(tapList, 2) <> 0 then
  328.         if ((click - getAt(tapList, 2)) <= 80) and ((click - getAt(tapList, 2)) >= 10) then
  329.           puppetSprite(19, 0)
  330.           set media to float((click - getAt(tapList, 1)) / 2)
  331.           set bpm to float(3600) / media
  332.           if bpm > (6 * gBpmSong / 5) then
  333.             set bpm to float(6 * gBpmSong / 5)
  334.           end if
  335.           if bpm < (4 * gBpmSong / 5) then
  336.             set bpm to float(4 * gBpmSong / 5)
  337.           end if
  338.           set tapList to [0, 0]
  339.           IKMixBPM(bpm * 1000)
  340.           put bpm into field "fieldBpm"
  341.           set the textFont of member "fieldBpm" to "IK10"
  342.           set the foreColor of member "fieldBpm" to gGreen
  343.           set the locH of sprite 24 to (15 * ((100 * (bpm - gBpmSong) / gBpmSong) + 52) / 4) + 5
  344.           set the locV of sprite 24 to 362
  345.           updateStage()
  346.           if markerList = [] then
  347.             put EMPTY into field "fieldDuration"
  348.           else
  349.             case word 2 of field "fieldDuration" of
  350.               "sec":
  351.                 set sec to 1920 * the number of words in field "fieldMarkerSeq" / float(field "fieldBpm")
  352.                 set sec to integer(sec)
  353.                 set min to sec / 60
  354.                 if min = 0 then
  355.                   set min to "00"
  356.                 end if
  357.                 if (min >= 1) and (min <= 9) then
  358.                   set min to "0" & min
  359.                 end if
  360.                 set sec to sec mod 60
  361.                 if sec = 0 then
  362.                   set sec to "00"
  363.                 end if
  364.                 if (sec >= 1) and (sec <= 9) then
  365.                   set sec to "0" & sec
  366.                 end if
  367.                 put min & ":" & sec & "  sec" into field "fieldDuration"
  368.               otherwise:
  369.                 put 8 * the number of words in field "fieldMarkerSeq" & "  bars" into field "fieldDuration"
  370.             end case
  371.           end if
  372.           set the textFont of member "fieldDuration" to "IK10"
  373.           set the foreColor of member "fieldDuration" to gBlue
  374.         else
  375.           set tapList to [click, 0]
  376.           puppetSprite(19, 1)
  377.           set the loc of sprite 19 to point(507, 425)
  378.           set the ink of sprite 19 to 8
  379.           set the memberNum of sprite 19 to the number of member "Htap"
  380.           updateStage()
  381.         end if
  382.       else
  383.         if (getAt(tapList, 2) = 0) and (getAt(tapList, 1) <> 0) then
  384.           if ((click - getAt(tapList, 1)) <= 80) and ((click - getAt(tapList, 1)) >= 10) then
  385.             setAt(tapList, 2, click)
  386.           else
  387.             setAt(tapList, 1, click)
  388.           end if
  389.         else
  390.           setAt(tapList, 1, click)
  391.         end if
  392.         puppetSprite(19, 1)
  393.         set the memberNum of sprite 19 to the number of member "Htap"
  394.         set the loc of sprite 19 to point(507, 425)
  395.         set the ink of sprite 19 to 8
  396.         updateStage()
  397.       end if
  398.     end if
  399.   end if
  400.   set the editable of member "fieldBpm" to 0
  401. end
  402.