improve output cells

This commit is contained in:
cnlohr 2018-11-18 16:49:59 -05:00
parent 56dbb60933
commit c7a5f05da7

View file

@ -132,18 +132,15 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
if( led->led_note_attached[j] != -1 ) continue; if( led->led_note_attached[j] != -1 ) continue;
if( !led->timebased ) { selindex = j; break; } if( !led->timebased ) { selindex = j; break; }
float bias = 0;
float timeimp = 1;
if( led->snakey ) if( led->snakey )
{ {
// bias = (j - led->snakeyplace + led->total_leds+(rand()%100)*.01); float bias = 0;
// if( bias > led->total_leds ) bias -= led->total_leds; float timeimp = 1;
bias = (j - led->snakeyplace + led->total_leds) % led->total_leds; bias = (j - led->snakeyplace + led->total_leds) % led->total_leds;
if( bias > led->total_leds / 2 ) bias = led->total_leds - bias + 1; if( bias > led->total_leds / 2 ) bias = led->total_leds - bias + 1;
timeimp = 0; timeimp = 0;
}
float score = led->time_of_change[j] * timeimp + bias; float score = led->time_of_change[j] * timeimp + bias;
if( score < seltime ) if( score < seltime )
@ -152,6 +149,15 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
selindex = j; selindex = j;
} }
} }
else
{
if( led->time_of_change[j] < seltime )
{
seltime = led->time_of_change[j];
selindex = j;
}
}
}
if( selindex >= 0 ) if( selindex >= 0 )
{ {
led->led_note_attached[selindex] = i; led->led_note_attached[selindex] = i;