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 / 00504.ls < prev    next >
Encoding:
Text File  |  1999-09-17  |  8.0 KB  |  236 lines

  1. on exitFrame
  2.   global gBlue
  3.   set the textFont of member "fieldDuration" to "IK10"
  4.   set the foreColor of member "fieldDuration" to gBlue
  5.   go(the frame)
  6. end
  7.  
  8. on enterFrame
  9.   global gPlaySeq, gCont, gOldCont, gBpmPall, gBpmSong, gLoadSeq, gStartSeq, gYes, gOnSynth, gPosSynth, gYesQuit, gGreen, gBlue, gYellow, gRed, seqTempList, markerList, virTracklIst, markerSynthList, audioList
  10.   if not (the editable of member "fieldBpm") then
  11.     if (field "fieldBpm" < (4 * gBpmSong / 5)) or (field "fieldBpm" > (6 * gBpmSong / 5)) then
  12.       put gBpmSong into field "fieldBpm"
  13.       set the textFont of member "fieldBpm" to "IK10"
  14.       set the foreColor of member "fieldBpm" to gGreen
  15.       set the locH of sprite 24 to 200
  16.       set the locV of sprite 24 to 362
  17.       updateStage()
  18.       if word 2 of field "fieldDuration" = "sec" then
  19.         set sec to 1920 / float(field "fieldBpm") * the number of words in field "fieldMarkerSeq"
  20.         set sec to integer(sec)
  21.         set min to sec / 60
  22.         if min = 0 then
  23.           set min to "00"
  24.         end if
  25.         if (min >= 1) and (min <= 9) then
  26.           set min to "0" & min
  27.         end if
  28.         set sec to sec mod 60
  29.         if sec = 0 then
  30.           set sec to "00"
  31.         end if
  32.         if (sec >= 1) and (sec <= 9) then
  33.           set sec to "0" & sec
  34.         end if
  35.         put min & ":" & sec & "  sec" into field "fieldDuration"
  36.       end if
  37.       IKMixBPM(gBpmSong * 1000)
  38.     end if
  39.   end if
  40.   if the visible of window "synth" then
  41.     set pos to point(the mouseH + the stageLeft, the mouseV + the stageTop)
  42.     if inside(pos, the rect of window "synth") and the mouseDown then
  43.       set m to the mouseH + the stageLeft - getAt(the rect of window "synth", 1)
  44.       set N to the mouseV + the stageTop - getAt(the rect of window "synth", 2)
  45.       repeat while the mouseDown
  46.         set the rect of window "synth" to rect(the mouseH + the stageLeft - m, the mouseV + the stageTop - N, 318 + the mouseH + the stageLeft - m, 72 + the mouseV + the stageTop - N)
  47.         updateStage()
  48.       end repeat
  49.       set gPosSynth to the rect of window "synth"
  50.     end if
  51.   end if
  52.   if gLoadSeq <> VOID then
  53.     if (gLoadSeq <> EMPTY) and (FileExists(gLoadSeq) = 0) then
  54.       loadSeq()
  55.     end if
  56.   end if
  57.   if gYes then
  58.     set gYes to 0
  59.     if gOnSynth then
  60.       IKSynthStop()
  61.       set gOnSynth to 0
  62.     end if
  63.     if the visible of window "synth" then
  64.       close(window "synth")
  65.     end if
  66.     IKStop()
  67.     set markerSynthList to []
  68.     set gPlaySeq to 0
  69.     go("start", "menuSong")
  70.   end if
  71.   if gBpmPall then
  72.     if the mouseDown then
  73.       set x to the mouseH
  74.       if x > 273 then
  75.         set x to 273
  76.       end if
  77.       if x < 125 then
  78.         set x to 125
  79.       end if
  80.       set the locH of sprite 24 to x
  81.       set the locV of sprite 24 to 362
  82.       updateStage()
  83.     else
  84.       set gBpmPall to 0
  85.     end if
  86.     set bpm to (float((4 * the locH of sprite 24 / 15) - 52) * gBpmSong / float(100)) + gBpmSong - 1
  87.     IKMixBPM(bpm * 1000)
  88.     put bpm into field "fieldBpm"
  89.     set the textFont of member "fieldBpm" to "IK10"
  90.     set the foreColor of member "fieldBpm" to gGreen
  91.     if word 2 of field "fieldDuration" = "sec" then
  92.       set sec to 1920 / float(field "fieldBpm") * the number of words in field "fieldMarkerSeq"
  93.       set sec to integer(sec)
  94.       set min to sec / 60
  95.       if min = 0 then
  96.         set min to "00"
  97.       end if
  98.       if (min >= 1) and (min <= 9) then
  99.         set min to "0" & min
  100.       end if
  101.       set sec to sec mod 60
  102.       if sec = 0 then
  103.         set sec to "00"
  104.       end if
  105.       if (sec >= 1) and (sec <= 9) then
  106.         set sec to "0" & sec
  107.       end if
  108.       put min & ":" & sec & "  sec" into field "fieldDuration"
  109.       set the textFont of member "fieldDuration" to "IK10"
  110.       set the foreColor of member "fieldDuration" to gBlue
  111.     end if
  112.   end if
  113.   if gPlaySeq then
  114.     if IKGetCurrentBeat() = 20 then
  115.       set gOldCont to gCont
  116.     end if
  117.     if IKGetCurrentBeat() = 21 then
  118.       if gCont = gOldCont then
  119.         if gCont = count(markerList) then
  120.           set gCont to gStartSeq
  121.         else
  122.           set gCont to gCont + 1
  123.         end if
  124.         repeat with i = 1 to 8
  125.           set groove to word i of line getAt(markerList, gCont) of field "grooveMem"
  126.           if (groove <> "0") and getPos(audioList, chars(groove, 13, length(groove))) then
  127.             IKVolumeSync2(i, integer(chars(groove, 1, 3)))
  128.             IKPanSync2(i, integer(chars(groove, 7, 9)))
  129.             IKPlaySync(i, getPos(audioList, chars(groove, 13, length(groove))))
  130.             setAt(virTracklIst, i, getPos(audioList, chars(groove, 13, length(groove))))
  131.             setAt(stateTrackList, i, "on")
  132.             setAt(volValList, i, integer(chars(groove, 1, 3)))
  133.             setAt(panValList, i, integer(chars(groove, 7, 9)))
  134.             setAt(volPosList, i, integer(chars(groove, 4, 6)))
  135.             setAt(panPosList, i, integer(chars(groove, 10, 12)))
  136.             next repeat
  137.           end if
  138.           IKPlaySync(i, -1)
  139.           setAt(virTracklIst, i, -1)
  140.           setAt(stateTrackList, i, "off")
  141.           setAt(volValList, i, 28)
  142.           setAt(panValList, i, 64)
  143.           setAt(volPosList, i, 239)
  144.           setAt(panPosList, i, 239)
  145.         end repeat
  146.       end if
  147.     end if
  148.     if IKGetCurrentBeat() = 31 then
  149.       case gCont of
  150.         count(markerList):
  151.           if (gCont - 1) = gStartSeq then
  152.             set the foreColor of word gCont - 1 of field "fieldMarkerSeq" to gYellow
  153.           else
  154.             set the foreColor of word gCont - 1 of field "fieldMarkerSeq" to 0
  155.           end if
  156.         gStartSeq:
  157.           set the foreColor of word count(markerList) of field "fieldMarkerSeq" to 0
  158.         otherwise:
  159.           case gCont - 1 of
  160.             gStartSeq:
  161.               set the foreColor of word gCont - 1 of field "fieldMarkerSeq" to gYellow
  162.             otherwise:
  163.               set the foreColor of word gCont - 1 of field "fieldMarkerSeq" to 0
  164.           end case
  165.       end case
  166.       set the foreColor of word gCont of field "fieldMarkerSeq" to gRed
  167.     end if
  168.   end if
  169.   set valore to IKGetCurrentBeat()
  170.   if (valore <> -1) and (virTracklIst <> [-1, -1, -1, -1, -1, -1, -1, -1]) then
  171.     set beat to (valore mod 4) + 1
  172.     set bar to (valore / 4) + 1
  173.     if beat <> 1 then
  174.       if the number of words in field "fieldBarBeat" <> 2 then
  175.         put "001      1" into field "fieldBarBeat"
  176.       else
  177.         if beat <> integer(word 2 of field "fieldBarBeat") then
  178.           put beat into word 2 of field "fieldBarBeat"
  179.         end if
  180.       end if
  181.     end if
  182.     if gPlaySeq then
  183.       if beat = 1 then
  184.         if (IKGetCurrentBeat() >= 21) and (IKGetCurrentBeat() <= 30) then
  185.           if gCont = gStartSeq then
  186.             set newBar to ((count(markerList) - 1) * 8) + bar
  187.           else
  188.             set newBar to ((gCont - 2) * 8) + bar
  189.           end if
  190.         else
  191.           set newBar to ((gCont - 1) * 8) + bar
  192.         end if
  193.         if newBar <= 9 then
  194.           set newBar to "00" & newBar
  195.         else
  196.           set newBar to "0" & newBar
  197.         end if
  198.         if newBar <> word 1 of field "fieldBarBeat" then
  199.           put newBar & "      " & beat into field "fieldBarBeat"
  200.         end if
  201.       end if
  202.     else
  203.       if (beat = 1) and (bar <> integer(word 1 of field "fieldBarBeat")) then
  204.         put "00" & bar & "      " & beat into field "fieldBarBeat"
  205.       end if
  206.     end if
  207.     set the textFont of member "fieldBarBeat" to "IK10"
  208.     set the foreColor of member "fieldBarBeat" to gGreen
  209.     set bar to "bar" & bar
  210.     set the memberNum of sprite 39 to the number of member bar
  211.     set the loc of sprite 39 to point(138, 239)
  212.   else
  213.     set the memberNum of sprite 39 to 1000
  214.     put EMPTY into field "fieldBarBeat"
  215.   end if
  216.   if the visible of window "Help" then
  217.     moveHelp()
  218.     showSeqMessage()
  219.   end if
  220.   if gYesQuit then
  221.     uscita()
  222.     go("exit")
  223.   end if
  224.   if getAt(tapList, 2) then
  225.     if (the timer - getAt(tapList, 2)) > 80 then
  226.       puppetSprite(19, 0)
  227.     end if
  228.   else
  229.     if getAt(tapList, 1) then
  230.       if (the timer - getAt(tapList, 1)) > 80 then
  231.         puppetSprite(19, 0)
  232.       end if
  233.     end if
  234.   end if
  235. end
  236.