From 8d8a931ec0622f3ed516e625e431db7caacce493 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Tue, 27 Sep 2011 06:51:02 +0200 Subject: [PATCH] assign percussion bots round-robin, looks better --- misc/tools/midi2cfg-ng.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/tools/midi2cfg-ng.pl b/misc/tools/midi2cfg-ng.pl index fad3a4e1..d8db264e 100755 --- a/misc/tools/midi2cfg-ng.pl +++ b/misc/tools/midi2cfg-ng.pl @@ -297,6 +297,8 @@ sub busybot_cmd_bot_execute($$@) { my ($bot, $time, @commands) = @_; + $bot->{lastuse} = $time; + for(@commands) { if($_->[0] eq 'time') @@ -340,7 +342,7 @@ sub busybot_cmd_bot_execute($$@) elsif($_->[0] eq 'barrier') { $commands .= sprintf "sv_cmd bot_cmd %d barrier\n", $bot->{id}; - $bot->{timer} = $bot->{busytimer} = 0; + $bot->{lastuse} = $bot->{timer} = $bot->{busytimer} = 0; } elsif($_->[0] eq 'raw') { @@ -514,7 +516,7 @@ sub busybot_note_on($$$$) my @epicfailbots = (); - for(unsort @busybots_allocated) + for(map { $_->[1] } sort { $a->[1]->{lastuse} <=> $b->[1]->{lastuse} or $a->[0] <=> $b->[0] } map { [rand, $_] } @busybots_allocated) { my $canplay = busybot_note_on_bot $_, $time, $channel, $program, $note, 0, 0; if($canplay > 0) -- 2.39.2