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 / 00369.ls < prev    next >
Encoding:
Text File  |  1999-09-17  |  18.7 KB  |  531 lines

  1. on keyUp
  2.   global gTraccia, gSolo, gRandom, gpag, gOn, gProg, gArp, gSynthSeq, gBpmSong, gPosVolSynth, gPosPanSynth, gSynthSel, gOnSynth, gGreen, stateTrackList, virTracklIst, tempList, panValList, volValLsit, markerList, folderSynthList, synthList, scaleList
  3.   if ((the key = "b") or (the key = "B")) and the shiftDown then
  4.     IKMixBPM(gBpmSong * 1000)
  5.     put gBpmSong into field "fieldBpm"
  6.     case the frame of
  7.       3:
  8.         set the loc of sprite 24 to point(322, 449)
  9.       7:
  10.         set the loc of sprite 24 to point(201, 362)
  11.       11:
  12.         set the loc of sprite 24 to point(319, 341)
  13.     end case
  14.     updateStage()
  15.     set the textFont of member "fieldBpm" to "IK10"
  16.     set the foreColor of member "fieldBpm" to gGreen
  17.   end if
  18.   case the frame of
  19.     2, 3:
  20.       case the keyPressed of
  21.         "a":
  22.           set temp to chars(the name of member the memberNum of sprite 12, 2, length(the name of member the memberNum of sprite 12))
  23.           if not integerp(integer(temp)) then
  24.             clickMarker()
  25.           end if
  26.         "q":
  27.           set gSolo to not gSolo
  28.           puppetSprite(11, 1)
  29.           clickSolo()
  30.         "w":
  31.           if (gTraccia <> 0) and gOn then
  32.             set spriteNum to 40 + gTraccia
  33.             set traccia to spriteNum - 40
  34.             clickControlTrack(traccia, spriteNum)
  35.           end if
  36.       end case
  37.       case the keyCode of
  38.         83, 84, 85, 86, 87, 88, 89:
  39.           set gTraccia to the keyCode - 82
  40.           puppetSprite(12, 1)
  41.           if gSolo and (getAt(stateTrackList, gTraccia) <> "off") then
  42.             clickControlTrack(gTraccia, 40 + gTraccia)
  43.           end if
  44.           clickTrack()
  45.         91:
  46.           set gTraccia to 8
  47.           puppetSprite(12, 1)
  48.           if gSolo and (getAt(stateTrackList, 8) <> "off") then
  49.             clickControlTrack(8, 48)
  50.           end if
  51.           clickTrack()
  52.       end case
  53.     6, 7:
  54.       case the keyCode of
  55.         49:
  56.           set the memberNum of sprite 36 to the number of member "redButton"
  57.           set the ink of sprite 36 to 8
  58.           updateStage()
  59.           put EMPTY into field "fieldState"
  60.           clickRedSeq()
  61.       end case
  62.     10, 11:
  63.       case the keyCode of
  64.         49:
  65.           if IKGetCurrentBeat() <> -1 then
  66.             set the memberNum of sprite 36 to the number of member "redMix"
  67.             updateStage()
  68.             clickRedMix()
  69.           end if
  70.       end case
  71.   end case
  72.   if the visible of window "synth" then
  73.     tell window "synth"
  74.       case the keyPressed of
  75.         ".":
  76.           if gOn and (folderSynthList <> []) and not (the visible of window "help") then
  77.             if synthList <> [] then
  78.               emptySynth()
  79.             end if
  80.           end if
  81.         "\":
  82.           clickLed()
  83.       end case
  84.       if the keyCode = 24 then
  85.         markSynth()
  86.       end if
  87.       set tasto to the keyPressed
  88.       if not (findPos(keyNoteList, tasto) = 0) then
  89.         if gOn and (IKGetCurrentBeat() <> -1) and (folderSynthList <> []) and not (the visible of window "help") then
  90.           set nota to getProp(keyNoteList, tasto)
  91.           set oct to ((findPos(keyNoteList, tasto) - 1) / count(scaleList)) + 1
  92.           set notaOct to nota & oct
  93.           set Gnota to "y" & nota
  94.           if not getPos(synthList, notaOct) then
  95.             repeat with i = ((oct - 1) * 12) + 4 to ((oct - 1) * 12) + 4 + 11
  96.               tell window "synth"
  97.                 if the name of member the memberNum of sprite i = nota then
  98.                   set the memberNum of sprite i to the number of member Gnota
  99.                   updateStage()
  100.                   exit repeat
  101.                 end if
  102.               end tell
  103.             end repeat
  104.             append(synthList, notaOct)
  105.           else
  106.             repeat with i = ((oct - 1) * 12) + 4 to ((oct - 1) * 12) + 4 + 11
  107.               tell window "synth"
  108.                 if the name of member the memberNum of sprite i = Gnota then
  109.                   set the memberNum of sprite i to the number of member nota
  110.                   updateStage()
  111.                   exit repeat
  112.                 end if
  113.               end tell
  114.             end repeat
  115.             deleteAt(synthList, getPos(synthList, notaOct))
  116.           end if
  117.           if synthList = [] then
  118.             set gOnSynth to 0
  119.             IKSynthStop()
  120.           else
  121.             if not gOnSynth then
  122.               set gOnSynth to 1
  123.             end if
  124.             case char 1 of gArp of
  125.               "[":
  126.                 set arp to 1
  127.               "]":
  128.                 set arp to 2
  129.               "{":
  130.                 set arp to 4
  131.               "}":
  132.                 set arp to 8
  133.             end case
  134.             IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  135.             IKSynthPan(integer(128 * (-gPosPanSynth + 54) / 45))
  136.             IKSynthArp(getPos(progList, gProg) - 1, arp, createSeq())
  137.           end if
  138.           if gSynthSel then
  139.             tell window "synth"
  140.               set the locH of sprite 74 to -20
  141.             end tell
  142.             set gSynthSel to 0
  143.           end if
  144.         end if
  145.       end if
  146.     end tell
  147.   end if
  148. end
  149.  
  150. on keyDown
  151.   global gTraccia, gpag, gOn, gOnSynth, gArp, gProg, gSynthSel, gPosVolSynth, gPosPanSynth, gBpmSong, gPath, gRandom, gBlue, gGreen, volValList, volPosList, stateTrackList, progList, folderSynthList, synthList, arpList, virTracklIst, randomizeList
  152.   if the visible of window "synth" then
  153.     tell window "synth"
  154.       if gOn and (folderSynthList <> []) and not (the visible of window "help") then
  155.         case the keyCode of
  156.           18, 19:
  157.             set pos to getPos(folderSynthList, field "fieldSynth")
  158.             if the keyCode = 19 then
  159.               if pos = count(folderSynthList) then
  160.                 set pos to 1
  161.               else
  162.                 set pos to pos + 1
  163.               end if
  164.             else
  165.               if pos = 1 then
  166.                 set pos to count(folderSynthList)
  167.               else
  168.                 set pos to pos - 1
  169.               end if
  170.             end if
  171.             put getAt(folderSynthList, pos) into field "fieldSynth"
  172.             set the textFont of member "fieldSynth" to "IK10"
  173.             set the foreColor of member "fieldSynth" to gBlue
  174.             if gOnSynth then
  175.               IKSynthStop()
  176.             end if
  177.             IKSetSynth(gPath & "Synth\" & field "fieldSynth" & "\")
  178.             case char 1 of gArp of
  179.               "[":
  180.                 set arp to 1
  181.               "]":
  182.                 set arp to 2
  183.               "{":
  184.                 set arp to 4
  185.               "}":
  186.                 set arp to 8
  187.             end case
  188.             IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  189.             IKSynthPan(integer(128 * (-gPosPanSynth + 54) / 45))
  190.             if synthList <> [] then
  191.               IKSynthArp(getPos(progList, gProg) - 1, arp, createSeq())
  192.             end if
  193.             if gSynthSel then
  194.               set the locH of sprite 74 to -20
  195.               set gSynthSel to 0
  196.             end if
  197.           20, 21:
  198.             set pos to getPos(arpList, field "fieldArp")
  199.             if the keyCode = 21 then
  200.               if pos = count(arpList) then
  201.                 set pos to 1
  202.               else
  203.                 set pos to pos + 1
  204.               end if
  205.             else
  206.               if pos = 1 then
  207.                 set pos to count(arpList)
  208.               else
  209.                 set pos to pos - 1
  210.               end if
  211.             end if
  212.             put getAt(arpList, pos) into field "fieldArp"
  213.             set the textFont of member "fieldArp" to "IK10"
  214.             set the foreColor of member "fieldArp" to gBlue
  215.             set gArp to field "fieldArp"
  216.             case char 1 of gArp of
  217.               "[":
  218.                 set arp to 1
  219.               "]":
  220.                 set arp to 2
  221.               "{":
  222.                 set arp to 4
  223.               "}":
  224.                 set arp to 8
  225.             end case
  226.             if gOnSynth then
  227.               IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  228.               IKSynthPan(integer(128 * (-gPosPanSynth + 54) / 45))
  229.               IKSynthArp(getPos(progList, gProg) - 1, arp, createSeq())
  230.             end if
  231.             if gSynthSel then
  232.               set the locH of sprite 74 to -20
  233.               set gSynthSel to 0
  234.             end if
  235.           23:
  236.             set pos to getPos(progList, field "fieldProg")
  237.             if pos = count(progList) then
  238.               set pos to 1
  239.             else
  240.               set pos to pos + 1
  241.             end if
  242.             put getAt(progList, pos) into field "fieldProg"
  243.             set the textFont of member "fieldProg" to "IK10"
  244.             set the foreColor of member "fieldProg" to gBlue
  245.             set gProg to field "fieldProg"
  246.             case char 1 of gArp of
  247.               "[":
  248.                 set arp to 1
  249.               "]":
  250.                 set arp to 2
  251.               "{":
  252.                 set arp to 4
  253.               "}":
  254.                 set arp to 8
  255.             end case
  256.             if gOnSynth then
  257.               IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  258.               IKSynthPan(integer(128 * (-gPosPanSynth + 54) / 45))
  259.               IKSynthArp(getPos(progList, gProg) - 1, arp, createSeq())
  260.             end if
  261.             if gSynthSel then
  262.               set the locH of sprite 74 to -20
  263.               set gSynthSel to 0
  264.             end if
  265.           22:
  266.             if gOn then
  267.               if gPosVolSynth < 54 then
  268.                 set the locV of sprite 45 to the locV of sprite 45 + 1
  269.                 set gPosVolSynth to the locV of sprite 45
  270.                 IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  271.                 updateStage()
  272.               end if
  273.             end if
  274.           26:
  275.             if gOn then
  276.               if gPosVolSynth > 9 then
  277.                 set the locV of sprite 45 to the locV of sprite 45 - 1
  278.                 set gPosVolSynth to the locV of sprite 45
  279.                 IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  280.                 updateStage()
  281.               end if
  282.             end if
  283.         end case
  284.       end if
  285.     end tell
  286.   end if
  287.   case the keyCode of
  288.     25, 29:
  289.       set bpm to field "fieldBpm"
  290.       if (the keyCode = 25) and (bpm > ((4 * gBpmSong / 5) + 1)) then
  291.         set bpm to bpm - 1
  292.         IKMixBPM(bpm * 1000)
  293.       end if
  294.       if (the keyCode = 29) and (bpm < ((6 * gBpmSong / 5) - 1)) then
  295.         set bpm to bpm + 1
  296.         IKMixBPM(bpm * 1000)
  297.       end if
  298.       put bpm into field "fieldBpm"
  299.       set the textFont of member "fieldBpm" to "IK10"
  300.       set the foreColor of member "fieldBpm" to gGreen
  301.       case the frame of
  302.         2, 3:
  303.           set the locH of sprite 24 to (15 * 25 * (bpm - gBpmSong) / gBpmSong) + 321
  304.           set the locV of sprite 24 to 449
  305.         6, 7:
  306.           set the locH of sprite 24 to (15 * ((100 * (bpm - gBpmSong) / gBpmSong) + 52) / 4) + 5
  307.           set the locV of sprite 24 to 362
  308.         10, 11:
  309.           set the locH of sprite 24 to (15 * 25 * (bpm - gBpmSong) / gBpmSong) + 321
  310.           set the locV of sprite 24 to 341
  311.       end case
  312.       updateStage()
  313.   end case
  314.   case the frame of
  315.     2, 3:
  316.       case the keyPressed of
  317.         "a":
  318.           set temp to chars(the name of member the memberNum of sprite 12, 2, length(the name of member the memberNum of sprite 12))
  319.           if not integerp(integer(temp)) then
  320.             set the memberNum of sprite 13 to the number of member "Hmarker"
  321.             set the ink of sprite 13 to 36
  322.             set the loc of sprite 13 to point(51, 240)
  323.             updateStage()
  324.           end if
  325.       end case
  326.       case the keyCode of
  327.         49:
  328.           puppetSprite(13, 1)
  329.           set the memberNum of sprite 13 to the number of member "Hred"
  330.           set the ink of sprite 13 to 36
  331.           set the loc of sprite 13 to point(320, 240)
  332.           updateStage()
  333.           clickRed()
  334.         70:
  335.           if gTraccia <> 0 then
  336.             if getAt(stateTrackList, gTraccia) <> "off" then
  337.               if getAt(volPosList, gTraccia) > 168 then
  338.                 setAt(volPosList, gTraccia, getAt(volPosList, gTraccia) - 1)
  339.                 set vol to (128 / power(1.02200000000000002, 142) * power(1.02200000000000002, ((-142 * the locV of sprite 3) + 142 + (310 * 141)) / 142)) + 4
  340.                 if integer(vol) = 124 then
  341.                   set vol to 128
  342.                 end if
  343.                 IKVolume(gTraccia, integer(vol))
  344.                 setAt(volValList, gTraccia, integer(vol))
  345.                 set the locV of sprite 3 to getAt(volPosList, gTraccia)
  346.                 updateStage()
  347.               end if
  348.             end if
  349.           end if
  350.         78:
  351.           if gTraccia <> 0 then
  352.             if getAt(stateTrackList, gTraccia) <> "off" then
  353.               if getAt(volPosList, gTraccia) < 310 then
  354.                 setAt(volPosList, gTraccia, getAt(volPosList, gTraccia) + 1)
  355.                 set vol to (128 / power(1.02200000000000002, 142) * power(1.02200000000000002, ((-142 * the locV of sprite 3) + 142 + (310 * 141)) / 142)) - 1
  356.                 if integer(vol) = 5 then
  357.                   set vol to 0
  358.                 end if
  359.                 IKVolume(gTraccia, integer(vol))
  360.                 setAt(volValList, gTraccia, integer(vol))
  361.                 set the locV of sprite 3 to getAt(volPosList, gTraccia)
  362.                 updateStage()
  363.               end if
  364.             end if
  365.           end if
  366.         125:
  367.           if gTraccia <> 0 then
  368.             case getAt(virTracklIst, gTraccia) of
  369.               (-1):
  370.                 set numLine to random(the lineCount of member "fieldAudio")
  371.               otherwise:
  372.                 if getAt(virTracklIst, gTraccia) = the lineCount of member "fieldAudio" then
  373.                   set numLine to 1
  374.                 else
  375.                   set numLine to getAt(virTracklIst, gTraccia)
  376.                 end if
  377.             end case
  378.             repeat while getOne(virTracklIst, numLine)
  379.               set numLine to numLine + 1
  380.               if numLine = (the lineCount of member "fieldAudio" + 1) then
  381.                 set numLine to 1
  382.               end if
  383.             end repeat
  384.             clickNameAudio(numLine)
  385.             set q to the lineCount of member "fieldAudio" / 20
  386.             set r to the lineCount of member "fieldAudio" mod 20
  387.             if r then
  388.               set numPag to q + 1
  389.             else
  390.               set numPag to q
  391.             end if
  392.             set q to numLine / 20
  393.             set r to numLine mod 20
  394.             if r then
  395.               set pag to q + 1
  396.             else
  397.               set pag to q
  398.             end if
  399.             if gpag > pag then
  400.               scrollByLine(member "fieldAudio", -20 * (gpag - pag))
  401.               set gpag to pag
  402.             else
  403.               if gpag < pag then
  404.                 scrollByLine(member "fieldAudio", 20 * (pag - gpag))
  405.                 set gpag to pag
  406.               end if
  407.             end if
  408.           end if
  409.         126:
  410.           if gTraccia <> 0 then
  411.             case getAt(virTracklIst, gTraccia) of
  412.               (-1):
  413.                 set numLine to random(the lineCount of member "fieldAudio")
  414.               otherwise:
  415.                 if getAt(virTracklIst, gTraccia) = 1 then
  416.                   set numLine to the lineCount of member "fieldAudio"
  417.                 else
  418.                   set numLine to getAt(virTracklIst, gTraccia)
  419.                 end if
  420.             end case
  421.             repeat while getOne(virTracklIst, numLine)
  422.               set numLine to numLine - 1
  423.               if numLine = 0 then
  424.                 set numLine to the lineCount of member "fieldAudio"
  425.               end if
  426.             end repeat
  427.             clickNameAudio(numLine)
  428.             set q to the lineCount of member "fieldAudio" / 20
  429.             set r to the lineCount of member "fieldAudio" mod 20
  430.             if r then
  431.               set numPag to q + 1
  432.             else
  433.               set numPag to q
  434.             end if
  435.             set q to numLine / 20
  436.             set r to numLine mod 20
  437.             if r then
  438.               set pag to q + 1
  439.             else
  440.               set pag to q
  441.             end if
  442.             if gpag > pag then
  443.               scrollByLine(member "fieldAudio", -20 * (gpag - pag))
  444.               set gpag to pag
  445.             else
  446.               if gpag < pag then
  447.                 scrollByLine(member "fieldAudio", 20 * (pag - gpag))
  448.                 set gpag to pag
  449.               end if
  450.             end if
  451.           end if
  452.         124:
  453.           set q to the lineCount of member "fieldAudio" / 20
  454.           set r to the lineCount of member "fieldAudio" mod 20
  455.           if r then
  456.             set numPag to q + 1
  457.           else
  458.             set numPag to q
  459.           end if
  460.           if gpag <> numPag then
  461.             scrollByLine(member "fieldAudio", 20)
  462.             set gpag to gpag + 1
  463.           else
  464.             scrollByLine(member "fieldAudio", -20 * (numPag - 1))
  465.             set gpag to 1
  466.           end if
  467.         123:
  468.           if gpag <> 1 then
  469.             scrollByLine(member "fieldAudio", -20)
  470.             set gpag to gpag - 1
  471.           else
  472.             set q to the lineCount of member "fieldAudio" / 20
  473.             set r to the lineCount of member "fieldAudio" mod 20
  474.             if r then
  475.               set numPag to q + 1
  476.             else
  477.               set numPag to q
  478.             end if
  479.             scrollByLine(member "fieldAudio", 20 * (numPag - 1))
  480.             set gpag to numPag
  481.           end if
  482.         115, 116, 119, 121:
  483.           if gTraccia then
  484.             set the foreColor of word 2 of line getAt(virTracklIst, gTraccia) of field "fieldAudio" to gGreen
  485.           end if
  486.           set gTraccia to 0
  487.           set the loc of sprite 3 to point(529, 239)
  488.           set the loc of sprite 4 to point(543, 239)
  489.           repeat with i = 1 to 8
  490.             if getAt(virTracklIst, i) <> -1 then
  491.               put "=" into word 1 of line getAt(virTracklIst, i) of field "fieldAudio"
  492.             end if
  493.           end repeat
  494.           scrollByLine(member "fieldAudio", -20 * (the lineCount of member "fieldAudio" / 20))
  495.           set gpag to 1
  496.           if virTracklIst <> [-1, -1, -1, -1, -1, -1, -1, -1] then
  497.             repeat with i = 1 to 8
  498.               setAt(tempList, i, getAt(virTracklIst, i))
  499.             end repeat
  500.           end if
  501.           set virTracklIst to [-1, -1, -1, -1, -1, -1, -1, -1]
  502.           case the keyCode of
  503.             115:
  504.               set gRandom to getAt(randomizeList, 1)
  505.             116:
  506.               set gRandom to getAt(randomizeList, 2)
  507.             119:
  508.               set gRandom to getAt(randomizeList, 4)
  509.             121:
  510.               set gRandom to getAt(randomizeList, 3)
  511.           end case
  512.           updateStage()
  513.           playRandom()
  514.       end case
  515.     6, 7:
  516.       case the keyCode of
  517.         49:
  518.           set the memberNum of sprite 36 to the number of member "HredSeq"
  519.           set the ink of sprite 36 to 36
  520.           updateStage()
  521.       end case
  522.     10, 11:
  523.       case the keyCode of
  524.         49:
  525.           if IKGetCurrentBeat() <> -1 then
  526.             set the memberNum of sprite 36 to the number of member "HredMix"
  527.           end if
  528.       end case
  529.   end case
  530. end
  531.