esselfortium

Adagio arc mod script

Jan 4th, 2021
1,450
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. { Compiled on Mon Jan  4 21:52:36 2021 }
  2. on init
  3.   make_perfview
  4.   set_script_title("SL Arcs Mods")
  5.   set_ui_height_px(256)
  6.   message("")
  7.   declare $i := 0
  8.   declare $note_id := 0
  9.   declare $prev_pos := 0
  10.   declare $keys_down := 0
  11.   declare $offset_calc := 0
  12.   make_persistent($offset_calc)
  13.   declare ui_knob $kAttack(0, 1000000, 1)
  14.   make_persistent($kAttack)
  15.   set_text($kAttack,"Attack")
  16.   set_knob_unit($kAttack,$KNOB_UNIT_MS)
  17.   $kAttack := get_engine_par($ENGINE_PAR_ATTACK,0,0,-1)
  18.   set_knob_label($kAttack,get_engine_par_disp($ENGINE_PAR_ATTACK,0,0,-1))
  19.   declare ui_knob $kRelease(0, 1000000, 1)
  20.   make_persistent($kRelease)
  21.   set_text($kRelease,"Release")
  22.   set_knob_unit($kRelease,$KNOB_UNIT_MS)
  23.   $kRelease := get_engine_par($ENGINE_PAR_RELEASE,0,0,-1)
  24.   set_knob_label($kRelease,get_engine_par_disp($ENGINE_PAR_RELEASE,0,0,-1))
  25.   declare ui_knob $kOffset(0, 1000000, 10000)
  26.   make_persistent($kOffset)
  27.   set_text($kOffset,"Offset")
  28.   set_knob_unit($kOffset,$KNOB_UNIT_PERCENT)
  29.   declare ui_button $bLegato
  30.   make_persistent($bLegato)
  31.   set_text($bLegato,"Poly Legato")
  32. end on
  33.  
  34. on ui_control($kAttack)
  35.   $i := 0
  36.   while ($i<$NUM_GROUPS)
  37.     set_engine_par($ENGINE_PAR_ATTACK,$kAttack,$i,0,-1)
  38.     inc($i)
  39.   end while
  40.   set_knob_label($kAttack,get_engine_par_disp($ENGINE_PAR_ATTACK,0,0,-1))
  41. end on
  42.  
  43. on ui_control($kRelease)
  44.   $i := 0
  45.   while ($i<$NUM_GROUPS)
  46.     set_engine_par($ENGINE_PAR_RELEASE,$kRelease,$i,0,-1)
  47.     inc($i)
  48.   end while
  49.   set_knob_label($kRelease,get_engine_par_disp($ENGINE_PAR_RELEASE,0,0,-1))
  50. end on
  51.  
  52. on ui_control($kOffset)
  53.   $offset_calc := $kOffset
  54. end on
  55.  
  56. on note
  57.   ignore_event($EVENT_ID)
  58.   if ($bLegato=1)
  59.     if ($keys_down>0)
  60.       $prev_pos := get_event_par($note_id,$EVENT_PAR_PLAY_POS)
  61.     else
  62.       $prev_pos := $offset_calc
  63.     end if
  64.   else
  65.     $prev_pos := $offset_calc
  66.   end if
  67.   $note_id := play_note($EVENT_NOTE,$EVENT_VELOCITY,$prev_pos,-1)
  68.   inc($keys_down)
  69.   inc($keys_down)
  70. end on
  71.  
  72. on release
  73.   dec($keys_down)
  74.   if ($keys_down<0)
  75.     $keys_down := 0
  76.   end if
  77. end on
  78.  
  79.  
RAW Paste Data