on init
	make_perfview {create performance view}
	set_ui_height_px(300) {set height of performance view}

	declare $t_round_robin_count := 0
	declare $rt_round_robin_count := 0

	{declaring a integer to store a note event later}
	declare $new_id2
end on

on note
	disallow_group($ALL_GROUPS)

	if ($t_round_robin_count = 0)
		allow_group(find_group("T-01"))
	end if

	if ($t_round_robin_count = 1)
		allow_group(find_group("T-02"))
	end if

	if ($t_round_robin_count = 2)
		allow_group(find_group("T-03"))
	end if

	if ($t_round_robin_count < 2)
		$t_round_robin_count := $t_round_robin_count + 1
	else
		$t_round_robin_count := 0
	end if
end on

on release
	disallow_group($ALL_GROUPS)

	if ($rt_round_robin_count = 0)
		allow_group(find_group("RT-01"))
	end if

	if ($rt_round_robin_count = 1)
		allow_group(find_group("RT-02"))
	end if

	if ($rt_round_robin_count = 2)
		allow_group(find_group("RT-03"))
	end if

	$new_id2 := play_note($EVENT_NOTE,$EVENT_VELOCITY,0,0)

	if ($rt_round_robin_count < 2)
		$rt_round_robin_count := $rt_round_robin_count + 1
	else
		$rt_round_robin_count := 0
	end if

end on