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 / 00648.ls < prev    next >
Encoding:
Text File  |  1999-09-17  |  9.4 KB  |  298 lines

  1. on exitFrame
  2.   go(the frame)
  3. end
  4.  
  5. on enterFrame
  6.   global gBpmPall, gBpmSong, gStyle, gCont, gOldCont, gPlaySong, gList, gRand, gRadio, gLoadMix, gSelDuration, gDuration, gFade, gYes, gAnim, gPath, gOnSynth, gToSeq, gPosSynth, gYesQuit, new, gGreen, gBlue, durationList, markerList, markerSynthList
  7.   if not (the editable of member "fieldBpm") then
  8.     if (field "fieldBpm" < (4 * gBpmSong / 5)) or (field "fieldBpm" > (6 * gBpmSong / 5)) then
  9.       put gBpmSong into field "fieldBpm"
  10.       set the textFont of member "fieldBpm" to "IK10"
  11.       set the foreColor of member "fieldBpm" to gGreen
  12.       set the locH of sprite 24 to 321
  13.       set the locV of sprite 24 to 341
  14.       updateStage()
  15.       IKMixBPM(gBpmSong * 1000)
  16.     end if
  17.   end if
  18.   if gPlaySong then
  19.     if IKGetCurrentBeat() = 20 then
  20.       set gOldCont to gCont
  21.     end if
  22.     if (IKGetCurrentBeat() = 21) and (gOldCont = gCont) then
  23.       set gCont to gCont + 1
  24.       if gCont <= (getAt(durationList, gStyle) / 8) then
  25.         if getAt(randomList, gCont) then
  26.           setAt(randomList, gCont, 0)
  27.           playStyle()
  28.         end if
  29.       end if
  30.     else
  31.       if (IKGetCurrentBeat() < 20) and (gCont > (getAt(durationList, gStyle) / 8)) then
  32.         set st to "s" & gStyle
  33.         set the memberNum of sprite (1 + gStyle) to the number of member st
  34.         updateStage()
  35.         if gList then
  36.           set gStyle to (gStyle mod 4) + 1
  37.           put "000      1" into field "fieldBarBeat"
  38.           clickStyle()
  39.         else
  40.           if gRand then
  41.             set gStyle to random(4)
  42.             put "000      1" into field "fieldBarBeat"
  43.             clickStyle()
  44.           else
  45.             if gRadio then
  46.               if gStyle = 4 then
  47.                 createSong()
  48.                 set gStyle to 1
  49.               else
  50.                 set gStyle to gStyle + 1
  51.               end if
  52.               put "000      1" into field "fieldBarBeat"
  53.               clickStyle()
  54.             else
  55.               set gPlaySong to 0
  56.               set gStyle to 0
  57.               if gOnSynth then
  58.                 IKSynthStop()
  59.                 set gOnSynth to 0
  60.               end if
  61.               IKStop()
  62.               IKFunction()
  63.             end if
  64.           end if
  65.         end if
  66.       end if
  67.       if gStyle <> 0 then
  68.         if ((gCont = (getAt(durationList, gStyle) / 8)) and (IKGetCurrentBeat() < 20)) or (gCont = ((getAt(durationList, gStyle) / 8) + 1)) then
  69.           set gFade to 1
  70.           IKMasterVolume(integer(field "fieldMasterVol") * (31 - IKGetCurrentBeat()) / 31)
  71.         end if
  72.       else
  73.         set gFade to 0
  74.       end if
  75.     end if
  76.     set valore to IKGetCurrentBeat()
  77.     set beat to (valore mod 4) + 1
  78.     set bar to (valore / 4) + 1
  79.     if (beat <> 1) and (beat <> word 2 of field "fieldBarBeat") then
  80.       put beat into word 2 of field "fieldBarBeat"
  81.     end if
  82.     if beat = 4 then
  83.       set new to 0
  84.     end if
  85.     if (beat = 1) and not new then
  86.       put 1 into word 2 of field "fieldBarBeat"
  87.       set m to integer(word 1 of field "fieldBarBeat") + 1
  88.       if m <= 9 then
  89.         set m to "00" & m
  90.       end if
  91.       if (m >= 10) and (m <= 99) then
  92.         set m to "0" & m
  93.       end if
  94.       put m into word 1 of field "fieldBarBeat"
  95.       set new to 1
  96.     end if
  97.     if word 1 of field "fieldBarBeat" = "000" then
  98.       put "001" into word 1 of field "fieldBarBeat"
  99.     end if
  100.     set bar to "bar" & bar
  101.     set the memberNum of sprite 39 to the number of member bar
  102.     set the loc of sprite 39 to point(320, 224)
  103.     set gAnim to gAnim + 1
  104.     if gAnim = 121 then
  105.       set gAnim to 49
  106.     end if
  107.     if gAnim <> 120 then
  108.       if the visible of sprite 120 then
  109.         set the visible of sprite gAnim to 0
  110.       else
  111.         set the visible of sprite gAnim to 1
  112.       end if
  113.     else
  114.       if the visible of sprite 49 then
  115.         set the visible of sprite gAnim to 1
  116.       else
  117.         set the visible of sprite gAnim to 0
  118.       end if
  119.     end if
  120.     if word 2 of field "fieldDuration" = "sec" then
  121.       set oldMin to chars(word 1 of field "fieldDuration", 1, length(word 1 of field "fieldDuration") - 3)
  122.       set oldSec to chars(word 1 of field "fieldDuration", length(word 1 of field "fieldDuration") - 1, length(word 1 of field "fieldDuration"))
  123.       set oldSec to (oldMin * 60) + oldSec
  124.       set sec to 240 / float(field "fieldBpm") * getAt(durationList, gStyle)
  125.       set sec to integer(sec)
  126.       set min to sec / 60
  127.       if min = 0 then
  128.         set min to "00"
  129.       end if
  130.       if (min >= 1) and (min <= 9) then
  131.         set min to "0" & min
  132.       end if
  133.       set sec to sec mod 60
  134.       if sec = 0 then
  135.         set sec to "00"
  136.       end if
  137.       if (sec >= 1) and (sec <= 9) then
  138.         set sec to "0" & sec
  139.       end if
  140.       put min & ":" & sec & " sec" into field "fieldDuration"
  141.       set the textFont of member "fieldDuration" to "IK10"
  142.       set the foreColor of member "fieldDuration" to gBlue
  143.     end if
  144.   else
  145.     set gAnim to 48
  146.     repeat with i = 49 to 120
  147.       set the visible of sprite i to 0
  148.     end repeat
  149.     set the memberNum of sprite 39 to 1000
  150.     updateStage()
  151.     put EMPTY into field "fieldDuration"
  152.     put EMPTY into field "fieldBarBeat"
  153.     set gStyle to 0
  154.   end if
  155.   if the visible of window "Help" then
  156.     moveHelp()
  157.     showMixMessage()
  158.   end if
  159.   if gToSeq then
  160.     transferToSeq()
  161.   end if
  162.   if the visible of window "synth" then
  163.     set pos to point(the mouseH + the stageLeft, the mouseV + the stageTop)
  164.     if inside(pos, the rect of window "synth") and the mouseDown then
  165.       set m to the mouseH + the stageLeft - getAt(the rect of window "synth", 1)
  166.       set N to the mouseV + the stageTop - getAt(the rect of window "synth", 2)
  167.       repeat while the mouseDown
  168.         set the rect of window "synth" to rect(the mouseH + the stageLeft - m, the mouseV + the stageTop - N, 320 + the mouseH + the stageLeft - m, 72 + the mouseV + the stageTop - N)
  169.         updateStage()
  170.       end repeat
  171.       set gPosSynth to the rect of window "synth"
  172.     end if
  173.   end if
  174.   if gYes then
  175.     set gYes to 0
  176.     if gOnSynth then
  177.       IKSynthStop()
  178.       set gOnSynth to 0
  179.     end if
  180.     if the visible of window "synth" then
  181.       close(window "synth")
  182.     end if
  183.     IKStop()
  184.     set markerSynthList to []
  185.     set gPlaySong to 0
  186.     go("start", "menuSong")
  187.   end if
  188.   if gLoadMix <> VOID then
  189.     if (gLoadMix <> EMPTY) and (FileExists(gLoadMix) = 0) then
  190.       loadMix()
  191.     end if
  192.   end if
  193.   if gBpmPall then
  194.     if the mouseDown then
  195.       set x to the mouseH
  196.       if x > 395 then
  197.         set x to 395
  198.       end if
  199.       if x < 246 then
  200.         set x to 246
  201.       end if
  202.       set the locH of sprite 24 to x
  203.       set the locV of sprite 24 to 341
  204.       updateStage()
  205.     else
  206.       set gBpmPall to 0
  207.     end if
  208.     set bpm to (float(4 * (the locH of sprite 24 - 321) / 15) * gBpmSong / float(100)) + gBpmSong
  209.     IKMixBPM(bpm * 1000)
  210.     put bpm into field "fieldBpm"
  211.     set the textFont of member "fieldBpm" to "IK10"
  212.     set the foreColor of member "fieldBpm" to gGreen
  213.   end if
  214.   if gSelDuration then
  215.     if the mouseDown then
  216.       set campo to "fieldStyle" & gDuration
  217.       set dMax to the number of lines in field campo
  218.       set durata to 8 * (((dMax - 1) * (the mouseH - 162) / 43) + 1)
  219.       if durata < 8 then
  220.         set durata to 8
  221.       end if
  222.       if durata > (dMax * 8) then
  223.         set durata to dMax * 8
  224.       end if
  225.       set num to integer((21 * ((durata / 8) - 1) / (dMax - 1)) + 1)
  226.       set dNum to "d" & num
  227.       set the memberNum of sprite (5 + gDuration) to the number of member dNum
  228.       updateStage()
  229.       if gDuration = gStyle then
  230.         case word 2 of field "fieldDuration" of
  231.           "bars":
  232.             put durata into word 1 of field "fieldDuration"
  233.           "sec":
  234.             set sec to 240 * durata / float(field "fieldBpm")
  235.             set sec to integer(sec)
  236.             set min to sec / 60
  237.             if min = 0 then
  238.               set min to "00"
  239.             end if
  240.             if (min >= 1) and (min <= 9) then
  241.               set min to "0" & min
  242.             end if
  243.             set sec to sec mod 60
  244.             if sec = 0 then
  245.               set sec to "00"
  246.             end if
  247.             if (sec >= 0) and (sec <= 9) then
  248.               set sec to "0" & sec
  249.             end if
  250.             put min & ":" & sec into word 1 of field "fieldDuration"
  251.         end case
  252.       end if
  253.     else
  254.       set campo to "fieldStyle" & gDuration
  255.       set dMax to the number of lines in field campo
  256.       set durata to 8 * (((dMax - 1) * (the mouseH - 162) / 43) + 1)
  257.       if durata < 8 then
  258.         set durata to 8
  259.       end if
  260.       if durata > (dMax * 8) then
  261.         set durata to dMax * 8
  262.       end if
  263.       setAt(durationList, gDuration, durata)
  264.       if gDuration = gStyle then
  265.         if count(randomList) < (durata / 8) then
  266.           repeat with i = count(randomList) + 1 to durata / 8
  267.             append(randomList, 1)
  268.           end repeat
  269.         else
  270.           if count(randomList) > (durata / 8) then
  271.             repeat while count(randomList) > (durata / 8)
  272.               deleteAt(randomList, count(randomList))
  273.             end repeat
  274.           end if
  275.         end if
  276.       end if
  277.       set gSelDuration to 0
  278.     end if
  279.   end if
  280.   set the textFont of member "fieldBarBeat" to "IK10"
  281.   set the foreColor of member "fieldBarBeat" to gGreen
  282.   if gYesQuit then
  283.     uscita()
  284.     go("exit")
  285.   end if
  286.   if getAt(tapList, 2) then
  287.     if (the timer - getAt(tapList, 2)) > 80 then
  288.       puppetSprite(10, 0)
  289.     end if
  290.   else
  291.     if getAt(tapList, 1) then
  292.       if (the timer - getAt(tapList, 1)) > 80 then
  293.         puppetSprite(10, 0)
  294.       end if
  295.     end if
  296.   end if
  297. end
  298.