home *** CD-ROM | disk | FTP | other *** search
/ Sound, Music & MIDI Collection 2 / SMMVOL2.bin / DEMO / PRG / CIRCLES.ZIP / CI_MAIN.DIX / 00011_CIRCLE.ls < prev    next >
Encoding:
Text File  |  1995-05-01  |  11.2 KB  |  395 lines

  1. on circleload
  2.   global fcommand, scommand, sel_name
  3.   set sel_name to EMPTY
  4.   set scommand to "CIlo"
  5.   set fcommand to EMPTY
  6.   fsel("CIRCLE")
  7. end
  8.  
  9. on circleloadrun
  10.   global fcommand, scommand, sel_name, AR_nnsc, sample_offset, namepause_bs, t1_segcnt, t2_segcnt, t1_idxcnt, t2_idxcnt, ver_cfile, l_notload, newidx, demo
  11.   set fcommand to EMPTY
  12.   set scommand to EMPTY
  13.   set tmp_size to float(0)
  14.   set version_OK to 0
  15.   set l_notload to []
  16.   if sel_name = EMPTY then
  17.     exit
  18.   end if
  19.   if the machineType = 256 then
  20.     set file to FileIO(mnew, "read", sel_name)
  21.   else
  22.     set file to FileIO(mnew, "read", sel_name)
  23.   end if
  24.   if not objectp(file) then
  25.     updateStage()
  26.     exit
  27.   end if
  28.   cur_busy()
  29.   ledclear()
  30.   updateStage()
  31.   cleanup()
  32.   cleanUpArrs()
  33.   cleanupsounds()
  34.   set s to "Start"
  35.   set AR_nnsc to 1
  36.   set tmp1idx to 0
  37.   set tmp2idx to 12
  38.   clear_ARidx()
  39.   cur_busy()
  40.   repeat while 1
  41.     set s to file(mReadLine)
  42.     if s <> EMPTY then
  43.       if s <> RETURN then
  44.         set s to correct_s(s)
  45.         set lncmd to chars(s, 1, 1)
  46.         if lncmd = "-" then
  47.           if (s & RETURN) = ver_cfile then
  48.             set version_OK to 1
  49.           end if
  50.         else
  51.           if version_OK then
  52.             if (lncmd = "1") or (lncmd = "2") then
  53.               set tmpsound to chars(s, 11, length(s))
  54.               set newidx to find_slot()
  55.               if tmpsound <> namepause_bs then
  56.                 if demo then
  57.                   set tmp_size to readsound(the pathName & tmpsound, newidx, 1)
  58.                 else
  59.                   set tmp_size to readsound(tmpsound, newidx, 1)
  60.                 end if
  61.               else
  62.                 set tmp_size to 1
  63.               end if
  64.               if lncmd = "1" then
  65.                 set tmp1idx to tmp1idx + 1
  66.                 set tmpidx to tmp1idx
  67.                 set t1_segcnt to t1_segcnt + value(chars(s, 4, 5))
  68.                 set t1_idxcnt to t1_idxcnt + 1
  69.               else
  70.                 set tmp2idx to tmp2idx + 1
  71.                 set tmpidx to tmp2idx
  72.                 set t2_segcnt to t2_segcnt + value(chars(s, 4, 5))
  73.                 set t2_idxcnt to t2_idxcnt + 1
  74.               end if
  75.               if tmp_size < 1 then
  76.                 append(l_notload, tmpidx)
  77.               end if
  78.               if demo then
  79.                 if tmpsound <> namepause_bs then
  80.                   Ar1sound(mput, tmpidx, the pathName & tmpsound)
  81.                 else
  82.                   Ar1sound(mput, tmpidx, tmpsound)
  83.                 end if
  84.               else
  85.                 Ar1sound(mput, tmpidx, tmpsound)
  86.               end if
  87.               AR1idx(mput, tmpidx, tmpidx)
  88.               ar1pos(mput, tmpidx, value(chars(s, 2, 3)))
  89.               ar1seg(mput, tmpidx, value(chars(s, 4, 5)))
  90.               Ar1Vol(mput, tmpidx, value(chars(s, 6, 7)))
  91.               set TCol to value(chars(s, 8, 10))
  92.               if TCol = 0 then
  93.                 set TCol to calccol(tmpsound)
  94.               end if
  95.               Ar1col(mput, tmpidx, TCol)
  96.               Ar1play(mput, tmpidx, newidx)
  97.               Ar1time(mput, tmpidx, tmp_size)
  98.               set AR_nnsc to AR_nnsc + 1
  99.             else
  100.               if lncmd = "F" then
  101.                 if value(chars(s, 2, 3)) <> 13 then
  102.                   set hl to "LD" & chars(s, 2, 3)
  103.                   ledklick(hl)
  104.                 end if
  105.               else
  106.                 if lncmd = "T" then
  107.                   if value(chars(s, 2, 3)) <> 13 then
  108.                     set hl to "LD" & chars(s, 2, 3)
  109.                     ledklick(hl)
  110.                   end if
  111.                 end if
  112.               end if
  113.             end if
  114.           end if
  115.         end if
  116.       end if
  117.       next repeat
  118.     end if
  119.     exit repeat
  120.   end repeat
  121.   file(mdispose)
  122.   cur_on()
  123.   if not version_OK then
  124.     alertrd(" This file is not a CIRCLE elements datafile, or the file" & " was created by a previsious version of CIRCLE elements.", " Keine CIRCLE ELEMENTS Datei oder die Datei wurde von" & " einer aelteren CIRCLE ELEMENTS Version erzeugt.")
  125.   end if
  126.   circlemaster()
  127.   if isdemosegs(t1_idxcnt + t2_idxcnt) then
  128.     clear_circle()
  129.     exit
  130.   end if
  131.   if count(l_notload) > 0 then
  132.     set sel_name to EMPTY
  133.     set scommand to "LOST"
  134.     set fcommand to EMPTY
  135.   else
  136.     displaysegs()
  137.   end if
  138. end
  139.  
  140. on circlesave
  141.   global fcommand, scommand, sel_name, fl_search, idsw, demo
  142.   set sel_name to EMPTY
  143.   set fcommand to EMPTY
  144.   if demo then
  145.     if not idsw then
  146.       if isdemo() then
  147.         exit
  148.       end if
  149.     end if
  150.   end if
  151.   set scommand to "CISa"
  152.   if AR1idx(mget, 1) = 0 then
  153.     alertrd("Nothing to save !", "Nichts zum Speichern !")
  154.     set scommand to EMPTY
  155.     exit
  156.   end if
  157.   set fl_search to "CIRCLE"
  158.   selfname("CIRCLE")
  159. end
  160.  
  161. on circlesaverun
  162.   global file, fileName, fcommand, scommand, ver_cfile, tmp1idx, tmp2idx, selsegsize, selseglen, LED_1, LED_2, sel_name, up_csave, new_read, idsw
  163.   set fcommand to EMPTY
  164.   set scommand to EMPTY
  165.   set s to "Start"
  166.   if the machineType = 256 then
  167.     if idsw then
  168.       set file to FileIO(mnew, "write", sel_name)
  169.     else
  170.       set file to FileIO(mnew, "write", up_csave & sel_name)
  171.     end if
  172.   else
  173.     if idsw then
  174.       set file to FileIO(mnew, "write", sel_name)
  175.     else
  176.       set file to FileIO(mnew, "write", up_csave & sel_name)
  177.     end if
  178.   end if
  179.   if not objectp(file) then
  180.     alertrd("Error writing file !", "Fehler beim schreiben !")
  181.     updateStage()
  182.     exit
  183.   end if
  184.   cur_busy()
  185.   updateStage()
  186.   set s to ver_cfile
  187.   if the machineType = 256 then
  188.     set s to s & numToChar(10)
  189.   end if
  190.   file(mWriteString, s)
  191.   set hl to lzero(LED_1)
  192.   set s to "F" & hl & RETURN
  193.   if the machineType = 256 then
  194.     set s to s & numToChar(10)
  195.   end if
  196.   file(mWriteString, s)
  197.   set hl to lzero(LED_2)
  198.   set s to "T" & hl & RETURN
  199.   if the machineType = 256 then
  200.     set s to s & numToChar(10)
  201.   end if
  202.   file(mWriteString, s)
  203.   set tmp1idx to 1
  204.   set tmp2idx to 1
  205.   repeat with i = 1 to 24
  206.     if AR1idx(mget, i) <> 0 then
  207.       set s to "1"
  208.       if i > 12 then
  209.         set s to "2"
  210.       end if
  211.       set s to s & lzero(ar1pos(mget, i)) & lzero(ar1seg(mget, i)) & lzero(Ar1Vol(mget, i)) & lzero2(Ar1col(mget, i)) & string(Ar1sound(mget, i)) & RETURN
  212.       if the machineType = 256 then
  213.         set s to s & numToChar(10)
  214.       end if
  215.       file(mWriteString, s)
  216.     end if
  217.   end repeat
  218.   file(mWriteString, "--END" & RETURN & RETURN)
  219.   file(mSetFinderInfo, "TEXT", "CIEL")
  220.   file(mdispose)
  221.   cur_on()
  222.   set new_read to 1
  223.   if not idsw then
  224.     save_mix(1)
  225.   end if
  226. end
  227.  
  228. on copywindow
  229.   global cp_idx
  230.   put "COPY" into field "title"
  231.   put Ar1sound(mget, cp_idx) & RETURN & RETURN & "LENGTH :   " & chars(calcsize(Ar1time(mget, cp_idx)), 2, 8) & RETURN & RETURN & "VOLUME :           " & lzero(Ar1Vol(mget, cp_idx)) & RETURN into field "sndwin"
  232. end
  233.  
  234. on setwindow cname
  235.   global maxsegs, minsegs, vTSprite, sel_track, sel_idx, sel_pos, sel_seg, sel_cast, mixedloop
  236.   put "SOUND" into field "title"
  237.   set t_idx to ar_get("CAST", cname)
  238.   set mdebug to 0
  239.   if mdebug = 0 then
  240.     set s to Ar1sound(mget, t_idx) & RETURN & RETURN & "LENGTH :   " & chars(calcsize(Ar1time(mget, t_idx)), 2, 8) & RETURN & RETURN & "VOLUME :           " & lzero(Ar1Vol(mget, t_idx)) & RETURN
  241.     put s into field "sndwin"
  242.   end if
  243.   if mdebug = 1 then
  244.     set s to Ar1sound(mget, t_idx) & RETURN & "cst " & string(ar1cast(mget, t_idx)) & " idx " & string(t_idx) & RETURN & " p " & string(ar1pos(mget, t_idx)) & " s " & string(ar1seg(mget, t_idx)) & RETURN & string(Ar1time(mget, t_idx)) & RETURN & "TL: " & string(t_idx) & " l:>" & string(getAt(ltl_len, t_idx)) & "<>" & string(getAt(ltl_time, t_idx)) & RETURN & "<cast>" & string(getAt(ltl_scast, t_idx))
  245.     put s into field "sndwin"
  246.   end if
  247.   if t_idx > 12 then
  248.     set sel_track to 2
  249.   end if
  250.   if t_idx <= 12 then
  251.     set sel_track to 1
  252.   end if
  253.   set sel_idx to t_idx
  254.   set sel_pos to ar1pos(mget, t_idx)
  255.   set sel_seg to ar1seg(mget, t_idx)
  256.   set sel_cast to ar1cast(mget, t_idx)
  257.   segszdisp("SG" & sel_seg)
  258.   setslider(Ar1Vol(mget, t_idx))
  259.   set mixedloop to 0
  260. end
  261.  
  262. on setmastervol
  263.   global backcast, fcommand, segsprite, segcol, sel_track, sel_idx, sel_pos, sel_seg, last_mute, up_mvol, freemaster
  264.   set fcommand to EMPTY
  265.   set sel_track to 0
  266.   set backcast to 0
  267.   put "MASTER" into field "title"
  268.   put "VOLUME :           " & up_mvol & RETURN & RETURN & "MEMORY :      " & string(the freeBytes) & RETURN & RETURN & "MASTER :      " & string(freemaster) & RETURN & RETURN into field "sndwin"
  269.   setslider(up_mvol)
  270.   set the volume of sound 1 to 255 / 15 * up_mvol
  271.   if segsprite <> 0 then
  272.     flashback(segsprite, segcol)
  273.   end if
  274.   if last_mute > 0 then
  275.     if last_mute = 2 then
  276.       mute0off()
  277.       mute2On()
  278.     else
  279.       mute0off()
  280.       mute1On()
  281.     end if
  282.     set last_mute to 0
  283.   end if
  284. end
  285.  
  286. on save_mix yesno
  287.   global nn_mixcast, nn_mixcastinit, fcommand, scommand, fl_search
  288.   set mixsave to 0
  289.   if yesno then
  290.     set mixsave to selwin("Save the hole CIRCLE as one" & " ELEMENT ?", "Den gesamten CIRCLE in einem" & " ELEMENT speichern ?")
  291.   end if
  292.   waitforup()
  293.   if mixsave then
  294.     set scommand to "MXSa"
  295.     set fl_search to "SOUND"
  296.     selfname("SOUND")
  297.   end if
  298. end
  299.  
  300. on forceleading
  301.   global fcommand, LED_1, LED_2, t1_segcnt, t2_segcnt, t1_idxcnt, t2_idxcnt
  302.   set fcommand to EMPTY
  303.   if AR1idx(mget, 1) = 0 then
  304.     return 
  305.   end if
  306.   cur_busy()
  307.   set p1idx to 1
  308.   set p2idx to 13
  309.   repeat with i = 1 to t1_idxcnt
  310.     set t1s to value(ar1seg(mget, i))
  311.     set t2ssum to 0
  312.     set p2idxsave to p2idx
  313.     set p3idxsave to p2idx
  314.     repeat with j = 1 to t1s
  315.       if p2idx <= (t2_idxcnt + 12) then
  316.         set nex2seg to value(ar1seg(mget, p2idx))
  317.         set t2ssum to t2ssum + value(ar1seg(mget, p2idx))
  318.         set p2idx to p2idx + 1
  319.         if t2ssum >= t1s then
  320.           exit repeat
  321.         end if
  322.       end if
  323.     end repeat
  324.     if t2ssum > t1s then
  325.       set deltat to t2ssum - t1s
  326.       repeat while 1
  327.         set ht2 to value(ar1seg(mget, p2idxsave))
  328.         if ht2 > 1 then
  329.           ar1seg(mput, p2idxsave, lzero(ht2 - 1))
  330.           set deltat to deltat - 1
  331.           set t2_segcnt to t2_segcnt - 1
  332.           t2jerusalem(p2idxsave + 1, 1)
  333.         else
  334.           set p2idxsave to p2idxsave + 1
  335.         end if
  336.         if deltat < 1 then
  337.           set p2idx to p2idxsave + 1
  338.           exit repeat
  339.         end if
  340.       end repeat
  341.     end if
  342.   end repeat
  343.   displaysegs()
  344.   cur_on()
  345. end
  346.  
  347. on t2jerusalem idx, sub
  348.   global t2_idxcnt
  349.   repeat with i = idx to t2_idxcnt + 12
  350.     set vhelp to value(ar1pos(mget, i))
  351.     set vhelp to vhelp - sub
  352.     ar1pos(mput, i, lzero(vhelp))
  353.   end repeat
  354. end
  355.  
  356. on remix ask
  357.   global t1_idxcnt, t2_segcnt, fcommand
  358.   if t2_segcnt < 1 then
  359.     set fcommand to EMPTY
  360.     return 
  361.   end if
  362.   if ask > 0 then
  363.     set mixmix to selwin("Do you want to remix the hole" & " CIRCLE ?", "Den gesamten CIRCLE remixen ?")
  364.     if mixmix = 0 then
  365.       return 
  366.     end if
  367.     ledclear()
  368.     ledklick("LD01")
  369.   end if
  370.   forceleading()
  371.   set mixmax to t1_idxcnt
  372.   set mixstart to ar_pos2idx(0, getstartidx(0))
  373.   repeat with i = mixstart to mixmax
  374.     set mixstart to value(ar1pos(mget, i))
  375.     set mixende to value(ar1seg(mget, i)) + mixstart
  376.     if mixstart > t2_segcnt then
  377.       exit repeat
  378.     end if
  379.     ledclear()
  380.     set hl to "LD" & lzero(mixstart)
  381.     ledklick(hl)
  382.     set hl to "LD" & lzero(mixende)
  383.     ledklick(hl)
  384.     circlemix()
  385.   end repeat
  386.   ledclear()
  387.   ledklick("LD01")
  388. end
  389.  
  390. on setdisk_col
  391.   global disk
  392.   if disk = "PLANET" then
  393.   end if
  394. end
  395.