home *** CD-ROM | disk | FTP | other *** search
/ Computer Music Interactif 7 / cd.iso / pc / PC / Demos / GroovMak / data1.cab / Program_Executable_Files / Media / Synth.dxr / 00158.ls < prev    next >
Encoding:
Text File  |  1999-09-17  |  3.3 KB  |  100 lines

  1. on loadSynth
  2.   global gPath, gArp, gProg, gOnSynth, gPosVolSynth, gPosPanSynth, gSynthSel, gLoadSynth, synthList, progList, arpList, folderSynthList
  3.   set loadSynth to gLoadSynth
  4.   set gLoadSynth to EMPTY
  5.   cursor(4)
  6.   set myFile to new(xtra("fileio"))
  7.   openFile(myFile, loadSynth, 1)
  8.   set theFile to readFile(myFile)
  9.   closeFile(myFile)
  10.   set myFile to 0
  11.   set sourceSynth to word 1 of line 2 of theFile
  12.   set isSynth to 1
  13.   repeat with j = 1 to the number of words in line 1 of theFile
  14.     if not getPos(["C1", "Cd1", "D1", "Dd1", "E1", "F1", "Fd1", "G1", "Gd1", "A1", "Ad1", "B1", "C2", "Cd2", "D2", "Dd2", "E2", "F2", "Fd2", "G2", "Gd2", "A2", "Ad2", "B2", "C3", "Cd3", "D3", "Dd3", "E3", "F3", "Fd3", "G3", "Gd3", "A3", "Ad3", "B3"], word j of line 1 of theFile) then
  15.       set isSynth to 0
  16.       exit repeat
  17.     end if
  18.   end repeat
  19.   if not getPos(folderSynthList, sourceSynth) then
  20.     set isSynth to 0
  21.   end if
  22.   if not getPos(arpList, word 2 of line 2 of theFile) then
  23.     set isSynth to 0
  24.   end if
  25.   if not getPos(progList, word 3 of line 2 of theFile) then
  26.     set isSynth to 0
  27.   end if
  28.   repeat with j = 4 to 5
  29.     if not ((integer(word j of line 2 of theFile) >= 9) and (integer(word 4 of line 2 of theFile) <= 54)) then
  30.       set isSynth to 0
  31.     end if
  32.   end repeat
  33.   if isSynth then
  34.     set synthList to []
  35.     repeat with i = 1 to the number of words in line 1 of theFile
  36.       setAt(synthList, i, word i of line 1 of theFile)
  37.     end repeat
  38.     set gArp to word 2 of line 2 of theFile
  39.     set gProg to word 3 of line 2 of theFile
  40.     set gPosVolSynth to integer(word 4 of line 2 of theFile)
  41.     set gPosPanSynth to integer(word 5 of line 2 of theFile)
  42.     put gProg into field "fieldProg"
  43.     put gArp into field "fieldArp"
  44.     put word 1 of line 2 of theFile into field "fieldSynth"
  45.     repeat with i = 1 to 3
  46.       set start to (12 * (i - 1)) + 3
  47.       repeat with j = 1 to 12
  48.         set nota to the name of member the memberNum of sprite (start + j)
  49.         if char 1 of nota = "y" then
  50.           set nota to chars(nota, 2, length(nota)) & i
  51.           if not getPos(synthList, nota) then
  52.             set nota to chars(nota, 1, length(nota) - 1)
  53.             set the memberNum of sprite (start + j) to the number of member nota
  54.             updateStage()
  55.           end if
  56.           next repeat
  57.         end if
  58.         set nota to nota & i
  59.         if getPos(synthList, nota) then
  60.           set nota to "y" & chars(nota, 1, length(nota) - 1)
  61.           set the memberNum of sprite (start + j) to the number of member nota
  62.           updateStage()
  63.         end if
  64.       end repeat
  65.     end repeat
  66.     if gOnSynth then
  67.       IKSynthStop()
  68.     else
  69.       set gOnSynth to 1
  70.     end if
  71.     IKSetSynth(gPath & "Synth\" & field "fieldSynth" & "\")
  72.     set the locV of sprite 45 to gPosVolSynth
  73.     set the locV of sprite 46 to gPosPanSynth
  74.     updateStage()
  75.     case char 1 of gArp of
  76.       "[":
  77.         set arp to 1
  78.       "]":
  79.         set arp to 2
  80.       "{":
  81.         set arp to 4
  82.       "}":
  83.         set arp to 8
  84.     end case
  85.     IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  86.     IKSynthPan(integer(128 * (-gPosPanSynth + 54) / 45))
  87.     IKSynthArp(getPos(progList, gProg) - 1, arp, createSeq())
  88.     if gSynthSel then
  89.       set the locH of sprite 74 to -20
  90.       set gSynthSel to 0
  91.     end if
  92.   else
  93.     openWin("Message")
  94.     tell window "Message"
  95.       go("21")
  96.     end tell
  97.   end if
  98.   cursor(-1)
  99. end
  100.