Update with dodecahedron visualization

This commit is contained in:
cnlohr 2018-11-09 07:02:53 -05:00
parent a02d56e20d
commit 298b33b0fe
3 changed files with 60 additions and 4 deletions

View file

@ -23,7 +23,7 @@
#include <netdb.h> #include <netdb.h>
#endif #endif
#define MAX_BUFFER 1487 #define MAX_BUFFER 1487*2
struct DPODriver struct DPODriver
{ {

View file

@ -31,8 +31,9 @@ struct CellsOutDriver
float satamp; float satamp;
float qtyamp; float qtyamp;
int steady_bright; int steady_bright;
int lastadvance;
int timebased; //Useful for pies, turn off for linear systems. int timebased; //Useful for pies, turn off for linear systems.
int snakey; //Advance head for where to get LEDs around.
int snakeyplace;
}; };
static void LEDUpdate(void * id, struct NoteFinder*nf) static void LEDUpdate(void * id, struct NoteFinder*nf)
@ -130,9 +131,24 @@ 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; }
if( led->time_of_change[j] < seltime )
float bias = 0;
float timeimp = 1;
if( led->snakey )
{ {
seltime = led->time_of_change[j]; // bias = (j - led->snakeyplace + led->total_leds+(rand()%100)*.01);
// if( bias > led->total_leds ) bias -= 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;
timeimp = 0;
}
float score = led->time_of_change[j] * timeimp + bias;
if( score < seltime )
{
seltime = score;
selindex = j; selindex = j;
} }
} }
@ -140,6 +156,7 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
{ {
led->led_note_attached[selindex] = i; led->led_note_attached[selindex] = i;
led->time_of_change[selindex] = Now; led->time_of_change[selindex] = Now;
led->snakeyplace = selindex;
} }
qtyDiff[i]--; qtyDiff[i]--;
} }
@ -182,6 +199,10 @@ static void LEDParams(void * id )
led->qtyamp = 20; RegisterValue( "qtyamp", PAFLOAT, &led->qtyamp, sizeof( led->qtyamp ) ); led->qtyamp = 20; RegisterValue( "qtyamp", PAFLOAT, &led->qtyamp, sizeof( led->qtyamp ) );
led->timebased = 1; RegisterValue( "timebased", PAINT, &led->timebased, sizeof( led->timebased ) ); led->timebased = 1; RegisterValue( "timebased", PAINT, &led->timebased, sizeof( led->timebased ) );
led->snakey = 0; RegisterValue( "snakey", PAINT, &led->snakey, sizeof( led->snakey ) );
led->snakeyplace = 0;
printf( "Found LEDs for output. leds=%d\n", led->total_leds ); printf( "Found LEDs for output. leds=%d\n", led->total_leds );
} }

View file

@ -0,0 +1,35 @@
outdrivers = DisplayNetwork, DisplayArray, OutputCells#OutputLinear
leds = 540
light_siding = 1.0 #Turn this to ~1.9 for more uniformity, ~1.0 for less.
satamp = 1.600
is_loop=1
led_floor = .1 #Turn to .25 for more uniformity, .1 for less.
steady_bright = 0
rgby = 1
sourcename = alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
#alsa_output.pci-0000_01_00.1.hdmi-stereo.monitor
# alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1.monitor
#alsa_output.pci-0000_00_1f.3.analog-stereo.monitor
skipfirst = 0
firstval = 0
port = 7777
address = 192.168.3.192
slope=.10
amplify=.5
qtyamp=50
timebased=1
lightx = 30
lighty = 18
snakey = 1
note_attach_amp_iir = 0.3500
note_attach_amp_iir2 = 0.250
note_attach_freq_iir = 0.3000