Hey all.
I'm having an issue with a round robin script. It's basically functional and working as intended, except for this:
Depending on how I have my MIDI mapping set up (I have menus and presets for this that are working perfectly), it will trigger random groups. It's almost like "disallow_group(ALL_GROUPS)" isn't working properly. I've been bashing my head against my desk trying to get this to work.
This is a trimmed-down version with an example mapping and two drum articulations. Each kit piece has multiple articulations per group. 8 round robins, with each articulation set 10 keys apart, starting on 0/C-2, then 10/A#-2, and so on.
I think I know the issue, in that in this example, when the Kick is triggered, and it plays a 0/C-2, the HatPedal is being triggered. I just can't figure out a workaround so that this doesn't happen.
on init
declare $i
declare $ArticulationOffset {Offset to determine what key the Round Robin playback starts on}
{*Round Robin*}
declare %RRobinArr [8]
declare $RRCount
$RRCount := num_elements(%RRobinArr)-1
declare $RR_1
declare $RR_2
{*NOTE MAPPING*}
declare $Art_Kick := 36
declare $Art_HatPedal := 0
end on
{*****************************************************************}
on note
{*****************************************************************}
ignore_event(EVENT_ID)
{*Round Robins*}
{*Kick*}
if (EVENT_NOTE = $Art_Kick)
disallow_group(ALL_GROUPS)
allow_group(0)
$ArticulationOffset := 0
change_note(EVENT_ID, $ArticulationOffset+%RRobinArr[$RRCount])
call RoundRobin
end if
{*HiHat*}
if (EVENT_NOTE = $Art_HatPedal)
disallow_group(ALL_GROUPS)
allow_group(270)
$ArticulationOffset := 0
change_note(EVENT_ID, $ArticulationOffset+%RRobinArr[$RRCount])
call RoundRobin
play_note($EVENT_NOTE, EVENT_VELOCITY, 0, 0)
end if
end on
function RoundRobin
inc($RRCount)
if ($RRCount>=num_elements(%RRobinArr))
$RR_1 := %RRobinArr[num_elements(%RRobinArr)-1]
%RRobinArr[0] := 0
$RRCount := 1
while ($RRCount # num_elements(%RRobinArr))
$RR_2 := random(0,$RRCount)
%RRobinArr[$RRCount] := %RRobinArr[$RR_2]
%RRobinArr[$RR_2] := $RRCount
inc($RRCount)
end while
$RRCount := 0
if (%RRobinArr[0]=$RR_1)
%RRobinArr[0] := %RRobinArr[num_elements(%RRobinArr)-1]
%RRobinArr[num_elements(%RRobinArr)-1] := $RR_1
end if
end if
end function