Infant scripting child here, so please be gentle. I'm trying to accomplish something fairly simple, which involves keeping my first five groups (1-5 (mic A)) , and my second set of five groups (6-10 (mic B)) together via their respective round robin position (ie RR position 1 is used for groups 1 & 6, RR position 2 is used for 2 & 7) but using code so that they cycle randomly while not repeating the last sample just played. David Hilowitz had posted a video on this subject, and I've read through some of the other threads, but I still can't find a method that works given the constraints.
on init
make_perfview
set_ui_height_px(255)
set_ui_width_px(633)
declare $mouse_resp := -900
set_control_par_str($INST_WALLPAPER_ID,$CONTROL_PAR_PICTURE,"instrumentbackground")
declare ui_slider $NEAR(0,1000000)
make_persistent($NEAR)
declare $k_NEAR
$k_NEAR := get_ui_id($NEAR)
set_control_par_str($k_NEAR,$CONTROL_PAR_PICTURE,"MK2-64")
set_control_par($k_NEAR,$CONTROL_PAR_POS_X,25)
set_control_par($k_NEAR,$CONTROL_PAR_POS_Y,80)
set_control_par($k_NEAR,$CONTROL_PAR_MOUSE_BEHAVIOUR,$mouse_resp)
declare ui_slider $Far(0,1000000)
make_persistent($Far)
declare $k_Far
$k_Far := get_ui_id($Far)
set_control_par_str($k_Far,$CONTROL_PAR_PICTURE,"MK2-64")
set_control_par($k_Far,$CONTROL_PAR_POS_X,110)
set_control_par($k_Far,$CONTROL_PAR_POS_Y,80)
set_control_par($k_Far,$CONTROL_PAR_MOUSE_BEHAVIOUR,$mouse_resp)
declare %rr_index[10] := (0,1,2,3,4,5,6,7,8,9) {not sure num is needed}
declare %rr_index_prev[10] := (0,1,2,3,4,5,6,7,8,9) {this may be incorrect}
end on
on ui_control($NEAR)
set_engine_par($ENGINE_PAR_VOLUME, $NEAR, -1, -1, $NI_BUS_OFFSET + 0)
end on
on ui_control($Far)
set_engine_par($ENGINE_PAR_VOLUME, $Far, -1, -1, $NI_BUS_OFFSET + 1)
end on
on note
if (rr_random = 0) {I get an error here saying ) expected}
%rr_index[$EVENT_NOTE] := %rr_index[$EVENT_NOTE] + 1
if %rr_index[$EVENT_NOTE] >= $MAX_RR
%rr_index[$EVENT_NOTE] := 0
end if
else
%rr_index_prev[$EVENT_NOTE] := %rr_index[$EVENT_NOTE]
while %rr_index[$EVENT_NOTE] = %rr_index_prev[$EVENT_NOTE]
%rr_index[$EVENT_NOTE] := random(0, $MAX_RR-1)
end while
end if
disallow_group($ALL_GROUPS)
allow_group(%rr_index[$EVENT_NOTE]) { Close? }
allow_group(%rr_index[$EVENT_NOTE] + 10) { Far? }
message("note -> " & $EVENT_NOTE & " / vel = " & $EVENT_VELOCITY & " / rr = " & rr_index[$EVENT_NOTE])
end on