Add output gamma

This commit is contained in:
cnlohr 2020-09-26 14:48:47 -07:00
parent 0121375d61
commit 1b7675ddd7
5 changed files with 66 additions and 8 deletions

View file

@ -30,6 +30,7 @@ struct CellsOutDriver
float light_siding;
float satamp;
float qtyamp;
float outgamma;
int steady_bright;
int timebased; //Useful for pies, turn off for linear systems.
int snakey; //Advance head for where to get LEDs around.
@ -184,7 +185,7 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
if( satQ > 1 ) satQ = 1;
float sendsat = (led->steady_bright?sat:satQ);
if( sendsat > 1 ) sendsat = 1;
int r = CCtoHEX( binpos[ia], 1.0, sendsat );
int r = CCtoHEX( binpos[ia], 1.0, pow( sendsat, led->outgamma ) );
OutLEDs[i*3+0] = r & 0xff;
OutLEDs[i*3+1] = (r>>8) & 0xff;
@ -204,6 +205,7 @@ static void LEDParams(void * id )
led->light_siding = 1.9;RegisterValue( "light_siding", PAFLOAT, &led->light_siding, sizeof( led->light_siding ) );
led->qtyamp = 20; RegisterValue( "qtyamp", PAFLOAT, &led->qtyamp, sizeof( led->qtyamp ) );
led->timebased = 1; RegisterValue( "timebased", PAINT, &led->timebased, sizeof( led->timebased ) );
led->outgamma = 1.0; RegisterValue( "outgamma", PAFLOAT, &led->outgamma, sizeof( led->outgamma ) );
led->snakey = 0; RegisterValue( "snakey", PAINT, &led->snakey, sizeof( led->snakey ) );

View file

@ -24,6 +24,7 @@ struct LEDOutDriver
float last_led_amp[MAX_LEDS];
int steady_bright;
float led_floor;
float outgamma;
float led_limit; //Maximum brightness
float satamp;
int lastadvance;
@ -177,14 +178,13 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
if( sendsat > led->led_limit ) sendsat = led->led_limit;
int r = CCtoHEX( led->last_led_pos[i], 1.0, sendsat );
int r = CCtoHEX( led->last_led_pos[i], 1.0, pow( sendsat, led->outgamma ) );
OutLEDs[i*3+0] = r & 0xff;
OutLEDs[i*3+1] = (r>>8) & 0xff;
OutLEDs[i*3+2] = (r>>16) & 0xff;
}
if( led->is_loop )
{
for( i = 0; i < led->total_leds; i++ )
@ -206,6 +206,7 @@ static void LEDParams(void * id )
led->is_loop = 0; RegisterValue( "is_loop", PAINT, &led->is_loop, sizeof( led->is_loop ) );
led->steady_bright = 1; RegisterValue( "steady_bright", PAINT, &led->steady_bright, sizeof( led->steady_bright ) );
led->led_limit = 1; RegisterValue( "led_limit", PAFLOAT, &led->led_limit, sizeof( led->led_limit ) );
led->outgamma = 1.0; RegisterValue( "outgamma", PAFLOAT, &led->outgamma, sizeof( led->outgamma ) );
printf( "Found LEDs for output. leds=%d\n", led->total_leds );

View file

@ -25,6 +25,7 @@ struct DPODriver
{
int xn;
int yn;
float outgamma;
float cutoff;
float satamp;
float amppow; //For amplitudes
@ -127,7 +128,7 @@ static void DPOUpdate(void * id, struct NoteFinder*nf)
float sat = nf->note_amplitudes_out[bestmatch] * d->satamp;
if( sat > 1.0 ) sat = 1.0;
float note_color = nf->note_positions[bestmatch] / nf->freqbins;
color = CCtoHEX( note_color, 1.0, sat );
color = CCtoHEX( note_color, 1.0, pow( sat, d->outgamma ) );
}
OutLEDs[led*3+0] = color & 0xff;
@ -146,7 +147,7 @@ static void DPOParams(void * id )
d->yn = 90; RegisterValue( "lighty", PAINT, &d->yn, sizeof( d->yn ) );
d->cutoff = .01; RegisterValue( "Voronoi_cutoff", PAFLOAT, &d->cutoff, sizeof( d->cutoff ) );
d->satamp = 5; RegisterValue( "satamp", PAFLOAT, &d->satamp, sizeof( d->satamp ) );
d->outgamma = 1.0; RegisterValue( "outgamma", PAFLOAT, &d->outgamma, sizeof( d->outgamma ) );
d->amppow = 2.51; RegisterValue( "amppow", PAFLOAT, &d->amppow, sizeof( d->amppow ) );
d->distpow = 1.5; RegisterValue( "distpow", PAFLOAT, &d->distpow, sizeof( d->distpow ) );

View file

@ -0,0 +1,51 @@
#For use with https://github.com/cnlohr/esp8266_dmx_explorer
outdrivers = DisplayArray,DisplayNetwork, OutputVoronoi
#OutputLinear
#OutputCells
#OutputLinear
#vornooi
lightx = 24
lighty = 7
fromsides = 1
outgamma=2.0
#cells
qtyamp=50
timebased=1
snakey = 1
steady_bright = 0
amppow = 1.00 #Higher willcull off not as bight things.
leds = 168
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.
note_attach_amp_iir = .2 #.3000
note_attach_amp_iir2 = .1 #.1500
note_attach_freq_iir = .3 #0.3000
steady_bright = 0
#dft_iir = 0.0
#dft_q = 20.0000
#dft_speedup = 1000.0000
sourcename = alsa_output.pci-0000_0a_00.1.hdmi-stereo-extra1.monitor
#alsa_output.pci-0000_0a_00.1.hdmi-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 = 3
firstval = 0
flipgb = 1
port = 7777
#address = 192.168.4.1
address = esp8266dmx.local
slope=.10
amplify=.1
led_floor=.1

View file

@ -1,14 +1,16 @@
#For use with https://github.com/cnlohr/esp8266_dmx_explorer
outdrivers = DisplayPie,DisplayNetwork, OutputLinear
outdrivers = DisplayPie,DisplayNetwork, OutputCells
#OutputLinear
#OutputCells
#OutputLinear
#cells
qtyamp=50
timebased=1
snakey = 0
snakey = 1
steady_bright = 0
outgamma=3
leds = 168
@ -38,7 +40,8 @@ port = 7777
#address = 192.168.4.1
address = esp8266dmx.local
slope=.10
amplify=.3
amplify=.1
led_floor=.1
lightx = 20