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

  1. on set_junk
  2.   global stopidx, startidx, loopidx, walkidx, junk_cst, junk_vol, junk_time, ltl_len, ltl_time, ltl_scast, ltl_mix, sample_offset, sample_rate, circle_qua, ticks_ps, ll_cast, ll_ttime, ll_size, ll_walk
  3.   repeat while 1
  4.     if loopidx > 12 then
  5.       return 
  6.     end if
  7.     set loop_add to value(getAt(ltl_len, loopidx))
  8.     if loop_add > 0 then
  9.       set newloopidx to loopidx + loop_add
  10.       exit repeat
  11.       next repeat
  12.     end if
  13.     set loopidx to loopidx + 1
  14.   end repeat
  15.   set junk_cst to getAt(ltl_scast, loopidx)
  16.   set the floatPrecision to 8
  17.   set ss to float(getAt(ltl_time * value(getAt(ltl_len, loopidx)), loopidx))
  18.   if circle_qua = "16" then
  19.     set ss to ss / 2
  20.     set sample_rate to 44100
  21.   else
  22.     set sample_rate to 22050
  23.   end if
  24.   set junk_time to integer(ss / sample_rate * ticks_ps)
  25.   set walkidx to walkidx + value(getAt(ltl_len, loopidx))
  26.   llst_insert(junk_cst, junk_time, junk_time, loopidx)
  27.   set loopidx to newloopidx
  28. end
  29.  
  30. on getstartidx track
  31.   global LED_1, LED_2, t1_segcnt, t2_segcnt
  32.   if (LED_1 = 0) or (LED_1 = 13) then
  33.     set startidx to 1
  34.   else
  35.     set startidx to LED_1
  36.   end if
  37.   if t1_segcnt > t2_segcnt then
  38.     set tmx to t1_segcnt
  39.   else
  40.     set tmx to t2_segcnt
  41.   end if
  42.   if startidx > tmx then
  43.     set startidx to 1
  44.   end if
  45.   return startidx + track
  46. end
  47.  
  48. on getstopidx track
  49.   global LED_1, LED_2, areon, t1_segcnt, t2_segcnt
  50.   set tl_mx to tl_maxpos(1)
  51.   if (LED_2 = 0) or (LED_2 = 13) or (areon < 2) then
  52.     set stopidx to tl_mx + 1
  53.   else
  54.     if (LED_2 - 1) > tl_mx then
  55.       set stopidx to tl_mx
  56.     else
  57.       set stopidx to LED_2
  58.     end if
  59.   end if
  60.   return stopidx + track
  61. end
  62.  
  63. on circlestop
  64.   global fcommand
  65.   set fcommand to EMPTY
  66.   puppetSound(0)
  67.   WALK(mrelease)
  68.   updateStage()
  69. end
  70.  
  71. on llst_init
  72.   global ll_cast, ll_ttime, ll_size, ll_walk, ll_name
  73.   set ll_cast to []
  74.   set ll_ttime to []
  75.   set ll_size to []
  76.   set ll_walk to []
  77.   set ll_name to []
  78. end
  79.  
  80. on llst_insert lcast, lttime, lsize, lwalk, lname
  81.   global ll_cast, ll_ttime, ll_size, ll_walk
  82.   append(ll_cast, lcast)
  83.   append(ll_ttime, lttime)
  84.   append(ll_size, lsize)
  85.   append(ll_walk, lwalk)
  86.   append(ll_name, lname)
  87. end
  88.  
  89. on gettlitems
  90.   global ltl_len, ltl_time, ltl_scast, ltl_mix
  91.   set retvar to 0
  92.   repeat with i = 1 to 12
  93.     set retvar to retvar + value(ltl_len, i)
  94.   end repeat
  95.   return retvar
  96. end
  97.  
  98. on gettlstart idx
  99.   global ltl_len, ltl_time, ltl_scast, ltl_mix
  100.   set retvar to 1
  101.   set cnt to 1
  102.   repeat with i = 1 to 12
  103.     set vlen to value(getAt(ltl_len, i))
  104.     if vlen > 0 then
  105.       if (retvar + vlen) > idx then
  106.         exit repeat
  107.       end if
  108.       set retvar to retvar + vlen
  109.       set cnt to cnt + 1
  110.     end if
  111.   end repeat
  112.   return cnt
  113. end
  114.  
  115. on gettlstop idx
  116.   global ltl_len, ltl_time, ltl_scast, ltl_mix, startidx
  117.   set retvar to 1
  118.   set cnt to 1
  119.   repeat with i = 1 to 12
  120.     set vlen to value(getAt(ltl_len, i))
  121.     if vlen > 0 then
  122.       if (retvar + vlen) >= idx then
  123.         exit repeat
  124.       end if
  125.       set retvar to retvar + vlen
  126.       set cnt to cnt + 1
  127.     end if
  128.   end repeat
  129.   return cnt
  130. end
  131.