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

  1. on mix
  2.   global gSong, gQMix, gPath, gCD, gGrooveSel, gOnSynth, gBpmSong, markerList, audioList
  3.   cursor(4)
  4.   IKSynthStop()
  5.   set gOnSynth to 0
  6.   IKStop()
  7.   if gGrooveSel <> 0 then
  8.     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)))
  9.     if (pNum <= gGrooveSel) and ((pNum + 7) >= gGrooveSel) then
  10.       set gN to "g" & gGrooveSel
  11.       set the memberNum of sprite (11 + gGrooveSel - pNum) to the number of member gN
  12.       updateStage()
  13.     end if
  14.     set gGrooveSel to 0
  15.   end if
  16.   set the foreColor of member "fieldMarkerSeq" to 0
  17.   put EMPTY into field "fieldState"
  18.   set testo to field "fieldBpm" & RETURN
  19.   repeat with j = 1 to count(markerList)
  20.     set numLine to getAt(markerList, j)
  21.     set tracce to 0
  22.     repeat with i = 1 to 8
  23.       set groove to word i of line numLine of field "grooveMem"
  24.       if (groove <> "0") and getPos(audioList, chars(groove, 13, length(groove))) then
  25.         set tracce to tracce + 1
  26.       end if
  27.     end repeat
  28.     set testo to testo & tracce & RETURN
  29.     repeat with i = 1 to 8
  30.       if word i of line numLine of field "grooveMem" <> "0" then
  31.         set groove to word i of line numLine of field "grooveMem"
  32.         set nomeFile to chars(groove, 13, length(groove))
  33.         if getPos(audioList, nomeFile) then
  34.           set testo to testo & getPos(audioList, nomeFile) && integer(chars(groove, 1, 3)) && integer(chars(groove, 7, 9)) & RETURN
  35.         end if
  36.       end if
  37.     end repeat
  38.   end repeat
  39.   set myFile to new(xtra("fileio"))
  40.   set nameFile to displaySave(myFile, "Save mix file", EMPTY)
  41.   set myFile to 0
  42.   if nameFile <> EMPTY then
  43.     if gQMix then
  44.       set nameFile to chars(nameFile, 1, length(nameFile) - 3) & "wav"
  45.     else
  46.       set nameFile to chars(nameFile, 1, length(nameFile) - 4)
  47.     end if
  48.     if gQMix then
  49.       IKQualityMix(nameFile, testo)
  50.     else
  51.       IKMultiTrackMix(nameFile, testo)
  52.     end if
  53.   end if
  54.   IKFunction()
  55.   cursor(-1)
  56. end
  57.  
  58. on clickRedSeq
  59.   global virTracklIst, volValList, volPosList, panValList, panPosList, stateTrackList, markerList, synthList, progList, audioList, gPlaySeq, gGrooveSel, gPath, gStartSeq, gCont, gOnSynth, gArp, gProg, gPosVolSynth, gPosPanSynth, gYellow, gRed, gBlue
  60.   if gGrooveSel <> 0 then
  61.     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)))
  62.     if (pNum <= gGrooveSel) and ((pNum + 7) >= gGrooveSel) then
  63.       set gN to "g" & gGrooveSel
  64.       set the memberNum of sprite (11 + gGrooveSel - pNum) to the number of member gN
  65.       updateStage()
  66.     end if
  67.     set gGrooveSel to 0
  68.   end if
  69.   if IKGetCurrentBeat() <> -1 then
  70.     if gOnSynth then
  71.       IKSynthStop()
  72.       set gOnSynth to 0
  73.     end if
  74.     IKStop()
  75.     IKFunction()
  76.     if gPlaySeq then
  77.       set gPlaySeq to 0
  78.     end if
  79.     set the foreColor of field "fieldMarkerSeq" to 0
  80.     if gStartSeq then
  81.       set the foreColor of word gStartSeq of field "fieldMarkerSeq" to gYellow
  82.     end if
  83.     set virTracklIst to [-1, -1, -1, -1, -1, -1, -1, -1]
  84.     set stateTrackList to ["off", "off", "off", "off", "off", "off", "off", "off"]
  85.     set volValList to [28, 28, 28, 28, 28, 28, 28, 28]
  86.     set panValList to [64, 64, 64, 64, 64, 64, 64, 64]
  87.     set volPosList to [239, 239, 239, 239, 239, 239, 239, 239]
  88.     set panPosList to [239, 239, 239, 239, 239, 239, 239, 239]
  89.   else
  90.     if field "fieldMarkerSeq" <> EMPTY then
  91.       set num to getAt(markerList, gStartSeq)
  92.       repeat with i = 1 to 8
  93.         set groove to word i of line num of field "grooveMem"
  94.         if (groove <> "0") and getPos(audioList, chars(groove, 13, length(groove))) then
  95.           IKVolume(i, integer(chars(groove, 1, 3)))
  96.           IKPan(i, integer(chars(groove, 7, 9)))
  97.           IKPlay(i, getPos(audioList, chars(groove, 13, length(groove))))
  98.           setAt(virTracklIst, i, getPos(audioList, chars(groove, 13, length(groove))))
  99.           setAt(stateTrackList, i, "on")
  100.           setAt(volValList, i, integer(chars(groove, 1, 3)))
  101.           setAt(volPosList, i, integer(chars(groove, 4, 6)))
  102.           setAt(panValList, i, integer(chars(groove, 7, 9)))
  103.           setAt(panPosList, i, integer(chars(groove, 10, 12)))
  104.           next repeat
  105.         end if
  106.         setAt(virTracklIst, i, -1)
  107.         setAt(stateTrackList, i, "off")
  108.         setAt(volValList, i, 28)
  109.         setAt(volPosList, i, 239)
  110.         setAt(panValList, i, 64)
  111.         setAt(panPosList, i, 239)
  112.       end repeat
  113.       set gCont to gStartSeq
  114.       set the foreColor of word gStartSeq of field "fieldMarkerSeq" to gRed
  115.       set gPlaySeq to 1
  116.       put "SEQUENCE  PLAYING" into field "fieldState"
  117.       set the textFont of member "fieldState" to "IK10"
  118.       set the foreColor of member "fieldState" to gBlue
  119.     end if
  120.   end if
  121. end
  122.  
  123. on loadSeq
  124.   global gLoadSeq, gPlaySeq, gfirstmarker, glastmarker, gGrooveSel, gPath, gFirstNum, gOnSynth, gSong, markerList, audioList
  125.   set loadSeq to gLoadSeq
  126.   set gLoadSeq to EMPTY
  127.   cursor(4)
  128.   set myFile to new(xtra("fileio"))
  129.   openFile(myFile, loadSeq, 1)
  130.   set theFile to readFile(myFile)
  131.   closeFile(myFile)
  132.   set myFile to 0
  133.   set sourceSong to line 1 of theFile
  134.   if sourceSong = (gSong && "seq") then
  135.     delete line 1 of theFile
  136.     put the last line in theFile into field "fieldMarkerSeq"
  137.     set the textFont of member "fieldMarkerSeq" to "Arial"
  138.     set the textSize of member "fieldMarkerSeq" to 10
  139.     set the foreColor of member "fieldMarkerSeq" to 0
  140.     delete char 1 of field "fieldMarkerSeq"
  141.     set markerList to []
  142.     repeat with i = 1 to the number of words in field "fieldMarkerSeq"
  143.       append(markerList, integer(word i of field "fieldMarkerSeq"))
  144.     end repeat
  145.     delete char -30003 of theFile
  146.     set user to 0
  147.     repeat with i = 1 to the number of words in theFile
  148.       set groove to word i of theFile
  149.       if (groove <> "0") and not getPos(audioList, chars(groove, 13, length(groove))) then
  150.         put "0" into word i of theFile
  151.         set user to user + 1
  152.       end if
  153.     end repeat
  154.     if user then
  155.       openWin("Message")
  156.       tell window "Message"
  157.         go("6")
  158.       end tell
  159.     end if
  160.     put theFile into field "grooveMem"
  161.     repeat with i = 1 to 8
  162.       set the memberNum of sprite (1 + i) to the number of member "marker"
  163.       set groove to "groove" & i
  164.       set the memberNum of sprite (i + 10) to the number of member groove
  165.       updateStage()
  166.     end repeat
  167.     case count(markerList) of
  168.       1, 2, 3, 4, 5, 6, 7:
  169.         repeat with i = 1 to count(markerList)
  170.           set gN to "g" & getAt(markerList, i)
  171.           set the memberNum of sprite (i + 1) to the number of member gN
  172.           updateStage()
  173.         end repeat
  174.         set gfirstmarker to 1
  175.         set glastmarker to count(markerList)
  176.       otherwise:
  177.         set j to 9
  178.         repeat with i = count(markerList) down to count(markerList) - 6
  179.           set j to j - 1
  180.           set gN to "g" & getAt(markerList, i)
  181.           set the memberNum of sprite j to the number of member gN
  182.           updateStage()
  183.         end repeat
  184.         set gfirstmarker to count(markerList) - 6
  185.         set glastmarker to count(markerList)
  186.     end case
  187.     set max to min(max(markerList), 8)
  188.     repeat with i = 1 to max
  189.       set gN to "g" & i
  190.       set the memberNum of sprite (10 + i) to the number of member gN
  191.       updateStage()
  192.     end repeat
  193.     case word 2 of field "fieldDuration" of
  194.       "sec":
  195.         set sec to 1920 * the number of words in field "fieldMarkerSeq" / float(field "fieldBpm")
  196.         set sec to integer(sec)
  197.         set min to sec / 60
  198.         if min = 0 then
  199.           set min to "00"
  200.         end if
  201.         if (min >= 1) and (min <= 9) then
  202.           set min to "0" & min
  203.         end if
  204.         set sec to sec mod 60
  205.         if sec = 0 then
  206.           set sec to "00"
  207.         end if
  208.         if (sec >= 1) and (sec <= 9) then
  209.           set sec to "0" & sec
  210.         end if
  211.         put min & ":" & sec & "  sec" into field "fieldDuration"
  212.       otherwise:
  213.         put 8 * the number of words in field "fieldMarkerSeq" & "  bars" into field "fieldDuration"
  214.     end case
  215.     if IKGetCurrentBeat() <> -1 then
  216.       if gOnSynth then
  217.         set gOnSynth to 0
  218.         IKSynthStop()
  219.       end if
  220.       IKStop()
  221.       IKFunction()
  222.     end if
  223.     set gGrooveSel to 0
  224.     if gPlaySeq then
  225.       set gPlaySeq to 0
  226.     end if
  227.     set gFirstNum to "1"
  228.   else
  229.     openWin("Message")
  230.     tell window "Message"
  231.       go("19")
  232.     end tell
  233.   end if
  234.   cursor(-1)
  235. end
  236.