Hey everyone,
I'm building a pretty simple instrument that only has four groups and I'm running into a bit of trouble figuring out how to manipulate the MIDI note number that each individual group receives. I'd like to have four sets of buttons on the UI that set the octave at which each group plays back.
For example, if I press C3 on the MIDI controller and have the group 0 transposition controls set to -1 (for minus one octave), then group 0 plays back C2 while the other groups play the original C3.
I've looked at the Interval factory script and understand how to apply that idea to the entire instrument, but my brain is having trouble trying to figure out how to split that between the individual groups.
So far, this is what my On Note CB looks like, including the factory Arpeggiator script, which I do not want to split between groups.
on note
disallow_group(ALL_GROUPS)
//ignore_event(EVENT_NOTE)
{Group on/off permissions}
if $sine_pnl_on_off_swi = 1
allow_group(0)
end if
if $square_pnl_on_off_swi = 1
allow_group(2)
end if
if $triangle_pnl_on_off_swi = 1
allow_group(1)
end if
if $saw_pnl_on_off_swi = 1
allow_group(3)
end if
{******************** ARP STUFF ********************}
if ($arp_pnl_on_off_swi = 1)
ignore_event($EVENT_ID)
{ make sure we only receive one event per key }
if (%note_ids[$EVENT_NOTE] > 0)
exit
else
%note_ids[$EVENT_NOTE] := $EVENT_ID
end if
select ($arp_pnl_latch_swi)
case 0
%note_buffer[$cursor] := $EVENT_NOTE
%vel_buffer[$cursor] := $EVENT_VELOCITY
inc($cursor)
case 1
if ($ENGINE_UPTIME - $old_latch_time > $LATCH_TIME)
$i := 0
while ($i < $cursor)
%note_buffer[$i] := 0
inc($i)
end while
$cursor := 0
end if
$old_latch_time := $ENGINE_UPTIME
%note_buffer[$cursor] := $EVENT_NOTE
%vel_buffer[$cursor] := $EVENT_VELOCITY
inc($cursor)
end select
{ start arpegiator }
if ($cursor < 2 and $seq_running = 0)
if ($NI_TRANSPORT_RUNNING = 0)
wait($REC_TIME_TRANSPORT_STOPPED * 1000)
else
wait($REC_TIME_TRANSPORT_RUNNING * 1000)
end if
call StartSeq()
end if
end if
end on
As I was writing this I took another look through the Event Commands chapter in the KSP manual but I must be missing something. I'm thinking I may be able to use set_event_mark() or set_event_par(), but I'm not seeing a way to tie those to a specific group.