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

  1. on soundeffect
  2.   global fcommand, gcast, t1_segcnt, t2_segcnt, t1_idxcnt, t2_idxcnt, AR_nnsc, sel_track, sel_idx, sel_pos, namepause_bs, p1_idx, p1_start, p1_stop, p1_vol, p1_name, p1_cast, p1_time, p2_idx, p2_start, p2_stop, p2_vol, p2_name, p2_cast, p2_time, acmixdest, acwin, cp_idx, eff_idx, eff_vol, eff_lidx
  3.   set fcommand to EMPTY
  4.   if sel_track = 0 then
  5.     alertrd("Select a ELEMENT for effect editing", "Ein ELEMENT fuer Effektbearbeitung auswaehlen.")
  6.     return 0
  7.   else
  8.     set eff_idx to sel_idx
  9.     set cp_idx to sel_idx
  10.     set cps to Ar1sound(mget, eff_idx)
  11.     if cps = namepause_bs then
  12.       exit
  13.       return 0
  14.     end if
  15.     set p1_start to 0
  16.     set p1_vol to Ar1Vol(mget, eff_idx)
  17.     set p1_name to Ar1sound(mget, eff_idx)
  18.     set p1_stop to value(Ar1time(mget, eff_idx))
  19.     set p1_idx to eff_idx
  20.     set p1_cast to Ar1play(mget, eff_idx)
  21.     set p1_time to value(Ar1time(mget, eff_idx))
  22.     set eff_vol to 16
  23.     set eff_lidx to 1
  24.     set p2_start to 0
  25.     set p2_vol to eff_vol
  26.     set p2_name to Ar1sound(mget, eff_idx)
  27.     set p2_stop to value(Ar1time(mget, eff_idx))
  28.     set p2_idx to eff_idx
  29.     set p2_cast to Ar1play(mget, eff_idx)
  30.     set p2_time to value(Ar1time(mget, eff_idx))
  31.     if charToNum(chars(cps, length(cps), length(cps))) < 33 then
  32.       set tmpsound to chars(cps, 1, length(cps) - 1)
  33.     else
  34.       set tmpsound to cps
  35.     end if
  36.     cur_busy()
  37.     effectwindow()
  38.     setslider(eff_vol)
  39.     effszklick("SG01")
  40.     set tmpsprite to getspritenum("EFXHI")
  41.     set the ink of sprite tmpsprite to 36
  42.     sprite_show(tmpsprite, 609, 355)
  43.     puppetSprite(tmpsprite, 1)
  44.     cur_on()
  45.     set acwin to "EFFE"
  46.     return 1
  47.   end if
  48. end
  49.  
  50. on eff_init
  51.   global leff_name, leff_time1, leff_time2
  52.   set leff_name to []
  53.   set leff_time1 to []
  54.   set leff_time2 to []
  55.   eff_set(1, "CHORUS I     ", 100, 73)
  56.   eff_set(2, "CHORUS II    ", 200, 147)
  57.   eff_set(3, "CHORUS III   ", 300, 295)
  58.   eff_set(4, "DELAY I   140", 400, 4725)
  59.   eff_set(5, "DELAY II  130", 500, 5088)
  60.   eff_set(6, "DELAY III 120", 600, 5512)
  61.   eff_set(7, "DELAY IV  110", 1000, 6013)
  62.   eff_set(8, "ECHO I    140", 2000, 9449)
  63.   eff_set(9, "ECHO II   120", 3000, 11025)
  64. end
  65.  
  66. on eff_set idx, name, time1, time2
  67.   global leff_name, leff_time1, leff_time2
  68.   setAt(leff_name, idx, name)
  69.   setAt(leff_time1, idx, time1)
  70.   setAt(leff_time2, idx, time2)
  71. end
  72.  
  73. on effect_close
  74.   global acwin, fcommand, p1_cast, eff_idx, mixedloop, demo
  75.   if demo then
  76.     alertrd(" This Demoversion does not support saving effects.", " In dieser Demoversion koennen Effekte nicht gespeichert werden.")
  77.   else
  78.     set yesno to selwin("Sound effect." & RETURN & "Do you want to keep the effect ?", "Soll der bearbeitete Effekt." & RETURN & "in den CIRCLE uebernommen werden ?")
  79.     if yesno then
  80.       if not mixedloop then
  81.         mkeffect()
  82.       end if
  83.       set dest to get_randfnmx("FX")
  84.       do_savesegeff(dest)
  85.       Ar1sound(mput, eff_idx, dest)
  86.       set sel_size to readsound(dest, p1_cast)
  87.       Ar1time(mput, eff_idx, sel_size)
  88.     end if
  89.   end if
  90.   circlemaster()
  91.   set tmpsprite to getspritenum("EFXHI")
  92.   sprite_blank(tmpsprite)
  93.   cur_on()
  94.   set acwin to "MAIN"
  95.   set fcommand to EMPTY
  96.   set mixedloop to 0
  97.   return 1
  98. end
  99.  
  100. on effszklick lbutton
  101.   global sel_track, sel_idx, sel_pos, sel_seg, sel_1circ, sel_2circ, mcast, t1_segcnt, t2_segcnt, t1_idxcnt, t2_idxcnt, fcommand, eff_lidx, mixedloop, p2_start
  102.   set tmpsprite to getspritenum("POINTER")
  103.   if sel_track = 0 then
  104.     set the locV of sprite tmpsprite to 1500
  105.     exit
  106.   end if
  107.   set segsztmp to value(chars(lbutton, 3, 4))
  108.   set segszval to segsztmp
  109.   if segsztmp = 8 then
  110.     set segsztmp to 7
  111.   end if
  112.   if segsztmp = 9 then
  113.     set segsztmp to 8
  114.   end if
  115.   if segsztmp = 12 then
  116.     set segsztmp to 9
  117.   end if
  118.   set eff_lidx to segsztmp
  119.   set sel_seg to chars(lbutton, 2, 3)
  120.   set the locV of sprite tmpsprite to 308 - ((9 - segsztmp) * 16)
  121.   effectwindow()
  122.   set mixedloop to 0
  123.   cur_on()
  124. end
  125.  
  126. on effmousedown
  127.   global mcast, fcommand, scommand, acwin, xy_copy, xy_past, xy_load, xy_save, xy_inse, xy_dele, xy_info, xy_ende, xy_paus, xy_halt, xy_mix, xy_rand, xy_setu, xy_l01, xy_l02, xy_l03, xy_l04, xy_l05, xy_l06, xy_l07, xy_l08, xy_l09, xy_l10, xy_l11, xy_l12, xy_m01, xy_m02, xy_s12, xy_s09, xy_s08, xy_s06, xy_s05, xy_s04, xy_s03, xy_s02, xy_s01, hp_r, hp_l, hp_x, hp_page, player, hp_itm01, hp_itm02, hp_itm03, hp_itm04, hp_itm05, hp_itm06, hp_itm07, hp_itm08, hp_itm09, hp_itm10, hp_itm11, hp_itm12, hp_itm13, ltl_mix
  128.   if the mouseDown and (acwin = "EFFE") then
  129.     set x to the mouseH
  130.     set y to the mouseV
  131.     set m_point to point(x, y)
  132.     set mcast to the mouseCast
  133.     snd_stop()
  134.     if inside(m_point, xy_ende) then
  135.       set fcommand to "ENDE"
  136.     end if
  137.     if inside(m_point, xy_rand) then
  138.       set fcommand to "EFFE"
  139.     end if
  140.     if inside(m_point, xy_info) then
  141.       set fcommand to "INFO"
  142.     end if
  143.     if inside(m_point, xy_s12) then
  144.       set fcommand to "SG12"
  145.     end if
  146.     if inside(m_point, xy_s09) then
  147.       set fcommand to "SG09"
  148.     end if
  149.     if inside(m_point, xy_s08) then
  150.       set fcommand to "SG08"
  151.     end if
  152.     if inside(m_point, xy_s06) then
  153.       set fcommand to "SG06"
  154.     end if
  155.     if inside(m_point, xy_s05) then
  156.       set fcommand to "SG05"
  157.     end if
  158.     if inside(m_point, xy_s04) then
  159.       set fcommand to "SG04"
  160.     end if
  161.     if inside(m_point, xy_s03) then
  162.       set fcommand to "SG03"
  163.     end if
  164.     if inside(m_point, xy_s02) then
  165.       set fcommand to "SG02"
  166.     end if
  167.     if inside(m_point, xy_s01) then
  168.       set fcommand to "SG01"
  169.     end if
  170.     if not player then
  171.       if inside(m_point, xy_halt) then
  172.         set fcommand to "HALT"
  173.       end if
  174.       if inside(m_point, rect(1, 450, 50, 479)) then
  175.         fsel("PATH")
  176.       end if
  177.     end if
  178.     if hp_page = 0 then
  179.       if inside(m_point, hp_itm01) then
  180.         help_open(1)
  181.       end if
  182.       if inside(m_point, hp_itm02) then
  183.         help_open(2)
  184.       end if
  185.       if inside(m_point, hp_itm03) then
  186.         help_open(3)
  187.       end if
  188.       if inside(m_point, hp_itm04) then
  189.         help_open(4)
  190.       end if
  191.       if inside(m_point, hp_itm05) then
  192.         help_open(5)
  193.       end if
  194.       if inside(m_point, hp_itm06) then
  195.         help_open(6)
  196.       end if
  197.       if inside(m_point, hp_itm07) then
  198.         help_open(7)
  199.       end if
  200.       if inside(m_point, hp_itm08) then
  201.         help_open(8)
  202.       end if
  203.       if inside(m_point, hp_itm09) then
  204.         help_open(9)
  205.       end if
  206.       if inside(m_point, hp_itm10) then
  207.         help_open(10)
  208.       end if
  209.       if inside(m_point, hp_itm11) then
  210.         help_open(11)
  211.       end if
  212.       if inside(m_point, hp_itm12) then
  213.         help_open(12)
  214.       end if
  215.     end if
  216.     if hp_page > 0 then
  217.       if inside(m_point, hp_r) then
  218.         help_R()
  219.       end if
  220.       if inside(m_point, hp_l) then
  221.         help_L()
  222.       end if
  223.       if inside(m_point, hp_x) then
  224.         help_X()
  225.       end if
  226.     end if
  227.   end if
  228.   if mcast = the number of cast "volume" then
  229.     set fcommand to "SLID"
  230.   end if
  231.   if mcast = the number of cast "title" then
  232.     set fcommand to "TITL"
  233.   end if
  234.   if mcast = the number of cast "sndwin" then
  235.     set fcommand to "MSTR"
  236.   end if
  237.   if mcast = the number of cast "lop" then
  238.     set fcommand to "LPCK"
  239.   end if
  240.   if mcast >= the number of cast "10101" then
  241.     set fcommand to "SEGS"
  242.   end if
  243.   put "Effect>" & fcommand
  244.   if fcommand = "SLID" then
  245.     effectslider()
  246.   else
  247.     if fcommand = "MSTR" then
  248.       effectplay()
  249.     else
  250.       if fcommand = "TITL" then
  251.         effectplay()
  252.       else
  253.         if fcommand = "ENDE" then
  254.           but_flash("QUIT", 591, 5)
  255.           circleend()
  256.         else
  257.           if fcommand = "SEGS" then
  258.             circleplay()
  259.           else
  260.             if fcommand = "EFFE" then
  261.               but_flash("EFX", 591, 336)
  262.               effect_close()
  263.             else
  264.               if fcommand = "INFO" then
  265.                 put "efx help"
  266.                 but_flash("HELP", 538 + 18, 5 + 9)
  267.                 help_open(0)
  268.               end if
  269.             end if
  270.           end if
  271.         end if
  272.       end if
  273.     end if
  274.   end if
  275.   if chars(fcommand, 1, 2) = "SG" then
  276.     effszklick(fcommand)
  277.   end if
  278. end
  279.  
  280. on effectslider cname
  281.   global steps, stepsize, maxsegs, eff_vol, mixedloop
  282.   set tmpsprite to getspritenum("VOLUME")
  283.   repeat while the mouseDown
  284.     set b to the mouseH
  285.     set mxsteps to 15
  286.     set slmax to 609
  287.     set slmin to 458
  288.     set sllen to slmax - slmin
  289.     set stepsize to sllen / mxsteps
  290.     if b >= slmax then
  291.       set the locH of sprite tmpsprite to slmax
  292.       set b to slmax
  293.     else
  294.       if b <= slmin then
  295.         set the locH of sprite tmpsprite to slmin
  296.         set b to slmin
  297.       else
  298.         set the locH of sprite tmpsprite to b
  299.       end if
  300.     end if
  301.     updateStage()
  302.   end repeat
  303.   set steps to (b - slmin) / stepsize
  304.   set eff_vol to steps
  305.   effectwindow()
  306.   set mixedloop to 0
  307. end
  308.  
  309. on effectwindow
  310.   global cp_idx, eff_vol, eff_lidx, leff_name
  311.   put "EFFECT" into field "title"
  312.   put Ar1sound(mget, cp_idx) & RETURN & RETURN & "EFFECT :   " & getAt(leff_name, eff_lidx) & RETURN & RETURN & "VOLUME :           " & lzero(eff_vol) & RETURN into field "sndwin"
  313. end
  314.  
  315. on mkeffect
  316.   global p1_idx, p1_start, p1_stop, p1_vol, p1_name, p1_cast, p1_time, p2_idx, p2_start, p2_stop, p2_vol, p2_name, p2_cast, p2_time, eff_vol, eff_idx, eff_time, leff_time2, eff_lidx, acmixdest, mixedloop
  317.   cur_busy()
  318.   set sp to getspritenum("MIX")
  319.   set the castNum of sprite sp to the number of cast "MIX_DO"
  320.   set the ink of sprite sp to 8
  321.   sprite_show(sp, 282, 199)
  322.   updateStage()
  323.   set p2_vol to eff_vol
  324.   set eff_time to getAt(leff_time2, eff_lidx)
  325.   set p1_start to 0
  326.   set p2_start to value(Ar1time(mget, eff_idx)) - eff_time
  327.   set p1_stop to eff_time
  328.   set p2_stop to value(Ar1time(mget, eff_idx))
  329.   set acmixdest to 0
  330.   mixit(0)
  331.   set p1_start to eff_time
  332.   set p2_start to 0
  333.   set p1_stop to value(Ar1time(mget, eff_idx))
  334.   set p2_stop to value(Ar1time(mget, eff_idx)) - eff_time
  335.   set acmixdest to eff_time
  336.   mixit(0)
  337.   set mixedloop to 1
  338.   set sp to getspritenum("MIX")
  339.   set the castNum of sprite sp to the number of cast "MIX"
  340.   set the ink of sprite sp to 8
  341.   sprite_show(sp, 282, 199)
  342.   cur_on()
  343. end
  344.  
  345. on midi_done
  346.   global mix_err, mix_vol1, mix_vol2, sndobj, up_mdicha
  347.   if the machineType = 256 then
  348.     if up_mdicha >= 0 then
  349.       set mix_err to sndobj(mMidiDone)
  350.       if mix_err <> 0 then
  351.         alert("SNDWORK Error while MIDIDone: " & mix_err)
  352.       end if
  353.     end if
  354.   end if
  355. end
  356.  
  357. on midi_init
  358.   global mix_err, mix_vol1, mix_vol2, sndobj, up_mdicha
  359.   if the machineType = 256 then
  360.     set mix_vol1 to string(up_mdicha)
  361.     set mix_vol2 to string(65535)
  362.     set mix_err to sndobj(mmidiinit)
  363.     if mix_err <> 0 then
  364.       alert("SNDWORK Error while MIDIInit: " & mix_err)
  365.     end if
  366.   end if
  367. end
  368.  
  369. on midi_active
  370.   global mix_err, mix_vol1, mix_vol2, mix_idx, sndobj, mix_qua, mix_size, mix_mon, mix_rate, t1_idxcnt, t2_idxcnt, sel_idx, sel_track, up_mdicha, up_mdinot, last_mdinote
  371.   set mididbg to 0
  372.   if the machineType = 256 then
  373.     if up_mdicha >= 0 then
  374.       set mix_vol1 to string(1)
  375.       set mdiactive to sndobj(mMidiActive)
  376.       if mdiactive > 0 then
  377.         if midflt_cha(mix_rate) then
  378.           set action to new_note()
  379.           if action = 1 then
  380.             midi_play()
  381.           else
  382.             if action = 2 then
  383.               midi_stop()
  384.             else
  385.               if mididbg then
  386.                 put "1mix_qua  hiw hib >" & mix_qua
  387.                 put "1mix_size hiw lob >" & mix_size
  388.                 put "1mix_mon  low hib >" & mix_mon
  389.                 put "1mix_rate low lob >" & integer(mix_rate - 127 - 16)
  390.                 put "1mix_err  status >" & mix_err
  391.                 put EMPTY
  392.               end if
  393.             end if
  394.           end if
  395.         end if
  396.         repeat while 1
  397.           set mdiactive to sndobj(mMidiGet)
  398.           if mdiactive > 0 then
  399.             exit repeat
  400.           end if
  401.           if midflt_cha(mix_rate) then
  402.             set action to new_note()
  403.             if action = 1 then
  404.               midi_play()
  405.               next repeat
  406.             end if
  407.             if action = 2 then
  408.               midi_stop()
  409.               next repeat
  410.             end if
  411.             if mididbg then
  412.               put "2mix_qua  hiw hib >" & mix_qua
  413.               put "2mix_size hiw lob >" & mix_size
  414.               put "2mix_mon  low hib >" & mix_mon
  415.               put "2mix_rate low lob >" & integer(mix_rate - 127 - 16)
  416.               put "2mix_err  status >" & mix_err
  417.               put EMPTY
  418.             end if
  419.           end if
  420.         end repeat
  421.       end if
  422.     end if
  423.   end if
  424. end
  425.  
  426. on midflt_cha cha
  427.   global up_mdicha
  428.   if up_mdicha <> 0 then
  429.     if integer(cha - 127 - 16) = up_mdicha then
  430.       return 1
  431.     else
  432.       return 0
  433.     end if
  434.   else
  435.     if integer(cha - 127 - 16) <= 16 then
  436.       return 1
  437.     else
  438.       return 0
  439.     end if
  440.   end if
  441. end
  442.  
  443. on new_note
  444.   global mix_qua, mix_size, mix_mon, mix_rate, t1_idxcnt, t2_idxcnt, sel_idx, sel_track, up_mdicha, up_mdinot, last_mdinote
  445.   if mix_size <> 0 then
  446.     if last_mdinote = -1 then
  447.       set last_mdinote to mix_mon
  448.       set retnn to 1
  449.     else
  450.       set retnn to 0
  451.     end if
  452.   else
  453.     if last_mdinote = mix_mon then
  454.       set last_mdinote to -1
  455.       set retnn to 2
  456.     else
  457.       set retnn to 0
  458.     end if
  459.   end if
  460.   return retnn
  461. end
  462.  
  463. on midi_play
  464.   global mix_qua, mix_size, mix_mon, mix_rate, t1_idxcnt, t2_idxcnt, sel_idx, sel_track, up_mdicha, up_mdinot, last_mdinote
  465.   set chknote to integer(last_mdinote - up_mdinot)
  466.   if chknote = 0 then
  467.     circleloopinit()
  468.   else
  469.     if (t1_idxcnt + t2_idxcnt) >= chknote then
  470.       if t1_idxcnt >= chknote then
  471.         set sel_track to 1
  472.         set sel_idx to integer(chknote)
  473.         circleplay()
  474.       else
  475.         set sel_track to 2
  476.         set sel_idx to integer(chknote - t1_idxcnt + 12)
  477.         circleplay()
  478.       end if
  479.     end if
  480.   end if
  481. end
  482.  
  483. on midi_stop
  484.   global mix_qua, mix_size, mix_mon, mix_rate, t1_idxcnt, t2_idxcnt, sel_idx, sel_track, up_mdicha, up_mdinot, last_mdinote
  485.   set chknote to integer(mix_mon - up_mdinot)
  486.   if chknote = 0 then
  487.     circleloopstop()
  488.   else
  489.     snd_stop()
  490.   end if
  491. end
  492.