From 298b33b0fe4eaa6598ef65f9b973c87da344819d Mon Sep 17 00:00:00 2001 From: cnlohr Date: Fri, 9 Nov 2018 07:02:53 -0500 Subject: [PATCH] Update with dodecahedron visualization --- colorchord2/DisplayNetwork.c | 2 +- colorchord2/OutputCells.c | 27 ++++++++++++++++++++++++--- colorchord2/dodecahedron.conf | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 colorchord2/dodecahedron.conf diff --git a/colorchord2/DisplayNetwork.c b/colorchord2/DisplayNetwork.c index b30ac5d..3471ce2 100644 --- a/colorchord2/DisplayNetwork.c +++ b/colorchord2/DisplayNetwork.c @@ -23,7 +23,7 @@ #include #endif -#define MAX_BUFFER 1487 +#define MAX_BUFFER 1487*2 struct DPODriver { diff --git a/colorchord2/OutputCells.c b/colorchord2/OutputCells.c index 4f5bee6..3e75392 100644 --- a/colorchord2/OutputCells.c +++ b/colorchord2/OutputCells.c @@ -31,8 +31,9 @@ struct CellsOutDriver float satamp; float qtyamp; int steady_bright; - int lastadvance; 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) @@ -130,9 +131,24 @@ static void LEDUpdate(void * id, struct NoteFinder*nf) { if( led->led_note_attached[j] != -1 ) continue; 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; } } @@ -140,6 +156,7 @@ static void LEDUpdate(void * id, struct NoteFinder*nf) { led->led_note_attached[selindex] = i; led->time_of_change[selindex] = Now; + led->snakeyplace = selindex; } qtyDiff[i]--; } @@ -182,6 +199,10 @@ static void LEDParams(void * id ) led->qtyamp = 20; RegisterValue( "qtyamp", PAFLOAT, &led->qtyamp, sizeof( led->qtyamp ) ); 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 ); } diff --git a/colorchord2/dodecahedron.conf b/colorchord2/dodecahedron.conf new file mode 100644 index 0000000..6e4eee2 --- /dev/null +++ b/colorchord2/dodecahedron.conf @@ -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 + +