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 / 00346.ls < prev    next >
Encoding:
Text File  |  1999-09-17  |  4.6 KB  |  140 lines

  1. on saveGroove
  2.   global gSong, gPath, stateTrackList, volValList, panValList, virTracklIst, volPosList, panPosList, audioList
  3.   set testo to gSong && "groove" & numToChar(13) & numToChar(10)
  4.   repeat with k = 1 to 8
  5.     if (getAt(stateTrackList, k) <> "off") and (getAt(stateTrackList, k) <> "mute") then
  6.       case length(string(getAt(volValList, k))) of
  7.         1:
  8.           set volVal to "00" & getAt(volValList, k)
  9.         2:
  10.           set volVal to "0" & getAt(volValList, k)
  11.         3:
  12.           set volVal to getAt(volValList, k)
  13.       end case
  14.       case length(string(getAt(panValList, k))) of
  15.         1:
  16.           set panVal to "00" & getAt(panValList, k)
  17.         2:
  18.           set panVal to "0" & getAt(panValList, k)
  19.         3:
  20.           set panVal to getAt(panValList, k)
  21.       end case
  22.       set testo to testo & volVal & getAt(volPosList, k) & panVal & getAt(panPosList, k) & getAt(audioList, getAt(virTracklIst, k)) & " "
  23.       next repeat
  24.     end if
  25.     set testo to testo & "0 "
  26.   end repeat
  27.   set myFile to new(xtra("fileio"))
  28.   setFilterMask(myFile, ".txt")
  29.   set nameFile to displaySave(myFile, "Save groove window", EMPTY)
  30.   createFile(myFile, nameFile)
  31.   openFile(myFile, nameFile, 2)
  32.   writeString(myFile, testo)
  33.   closeFile(myFile)
  34.   set myFile to 0
  35. end
  36.  
  37. on loadGroove
  38.   global gloadGroove, gpag, gPath, gProg, gArp, gOnSynth, gPosVolSynth, gPosPanSynth, gGrooveSel, gBlue, gSong, virTracklIst, volValList, volPosList, stateTrackList, panValList, panPosList, progList, synthList, keepList, audioList
  39.   set loadGroove to gloadGroove
  40.   set gloadGroove to EMPTY
  41.   cursor(4)
  42.   set gGrooveSel to 0
  43.   set the memberNum of sprite 12 to the number of member "jolly"
  44.   updateStage()
  45.   repeat with i = 1 to 8
  46.     if getAt(virTracklIst, i) <> -1 then
  47.       put "=" into word 1 of line getAt(virTracklIst, i) of field "fieldAudio"
  48.     end if
  49.   end repeat
  50.   set myFile to new(xtra("fileio"))
  51.   openFile(myFile, loadGroove, 1)
  52.   set theFile to readFile(myFile)
  53.   closeFile(myFile)
  54.   set myFile to 0
  55.   set sourceSong to line 1 of theFile
  56.   if sourceSong = (gSong && "groove") then
  57.     delete line 1 of theFile
  58.     set user to 0
  59.     repeat with i = 1 to 8
  60.       set groove to word i of theFile
  61.       if (groove <> "0") and not getPos(audioList, chars(groove, 13, length(groove))) then
  62.         set user to user + 1
  63.         put "0" into word i of theFile
  64.       end if
  65.     end repeat
  66.     repeat with i = 1 to 8
  67.       set info to word i of theFile
  68.       if info <> "0" then
  69.         setAt(volValList, i, integer(chars(info, 1, 3)))
  70.         setAt(volPosList, i, integer(chars(info, 4, 6)))
  71.         setAt(panValList, i, integer(chars(info, 7, 9)))
  72.         setAt(panPosList, i, integer(chars(info, 10, 12)))
  73.         setAt(virTracklIst, i, getPos(audioList, chars(info, 13, length(info))))
  74.         setAt(stateTrackList, i, "on")
  75.         next repeat
  76.       end if
  77.       setAt(volValList, i, 28)
  78.       setAt(volPosList, i, 293)
  79.       setAt(panValList, i, 64)
  80.       setAt(panPosList, i, 293)
  81.       setAt(virTracklIst, i, -1)
  82.       setAt(stateTrackList, i, "off")
  83.     end repeat
  84.     if user then
  85.       openWin("Message")
  86.       tell window "Message"
  87.         go("5")
  88.       end tell
  89.     end if
  90.     repeat with i = 1 to 8
  91.       if getAt(virTracklIst, i) <> -1 then
  92.         put i into word 1 of line getAt(virTracklIst, i) of field "fieldAudio"
  93.         set the foreColor of word 1 of line getAt(virTracklIst, i) of field "fieldAudio" to gBlue
  94.       end if
  95.     end repeat
  96.     IKSynthStop()
  97.     IKStop()
  98.     IKFunction()
  99.     repeat with i = 1 to 8
  100.       IKVolumeSync(i, getAt(volValList, i))
  101.       IKPanSync(i, getAt(panValList, i))
  102.       IKPlay(i, getAt(virTracklIst, i))
  103.     end repeat
  104.     if gOnSynth and (synthList <> []) then
  105.       case char 1 of gArp of
  106.         "[":
  107.           set arp to 1
  108.         "]":
  109.           set arp to 2
  110.         "{":
  111.           set arp to 4
  112.         "}":
  113.           set arp to 8
  114.       end case
  115.       IKSynthVolume(integer(128 * (-gPosVolSynth + 54) / 45))
  116.       IKSynthPan(integer(128 * (-gPosPanSynth + 54) / 45))
  117.       IKSynthArp(getPos(progList, gProg) - 1, arp, createSeq())
  118.     end if
  119.     repeat with i = 1 to 8
  120.       if getAt(virTracklIst, i) <> -1 then
  121.         set onNum to "on" & i
  122.         puppetSprite(40 + i, 1)
  123.         set the memberNum of sprite (40 + i) to the number of member onNum
  124.       else
  125.         set controlT to "controlT" & i
  126.         puppetSprite(40 + i, 1)
  127.         set the memberNum of sprite (40 + i) to the number of member controlT
  128.       end if
  129.       updateStage()
  130.     end repeat
  131.     set keepList to [0, 0, 0, 0, 0, 0, 0, 0]
  132.   else
  133.     openWin("Message")
  134.     tell window "Message"
  135.       go("18")
  136.     end tell
  137.   end if
  138.   cursor(-1)
  139. end
  140.