Merge pull request #125 from Eugene8388608/master

Fix color representation bugs
This commit is contained in:
Sam Ellicott 2021-11-06 00:38:29 -04:00 committed by GitHub
commit f6bfcb8bf9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 25 additions and 27 deletions

View file

@ -54,7 +54,7 @@ static void DPOUpdate(void * id, struct NoteFinder*nf)
{ {
index = x+y*d->xn; index = x+y*d->xn;
} }
CNFGColor( OutLEDs[index*3+0] | (OutLEDs[index*3+1] <<8)|(OutLEDs[index*3+2] <<16) ); CNFGColor( (OutLEDs[index*3+0] <<24) | (OutLEDs[index*3+1] <<16) | (OutLEDs[index*3+2] <<8) | 0xff );
float dx = (x) * cw; float dx = (x) * cw;
float dy = (y) * ch; float dy = (y) * ch;
@ -63,7 +63,7 @@ static void DPOUpdate(void * id, struct NoteFinder*nf)
else else
CNFGTackRectangle( dx, dy, dx+cw+.5, dy+ch+.5 ); CNFGTackRectangle( dx, dy, dx+cw+.5, dy+ch+.5 );
} }
CNFGColor( 0xffffff ); CNFGColor( 0xffffffff );
} }
static void DPOParams(void * id ) static void DPOParams(void * id )

View file

@ -130,9 +130,9 @@ static void DPOUpdate(void * id, struct NoteFinder*nf)
if( sat > 1 ) sat = 1; if( sat > 1 ) sat = 1;
uint32_t color = CCtoHEX( nf->note_positions[i] / nf->freqbins, 1.0, sat ); uint32_t color = CCtoHEX( nf->note_positions[i] / nf->freqbins, 1.0, sat );
OutLEDs[led*3+0] = color & 0xff; OutLEDs[led*3+0] = ( color >> 24 ) & 0xff;
OutLEDs[led*3+1] = ( color >> 8 ) & 0xff; OutLEDs[led*3+1] = ( color >> 16 ) & 0xff;
OutLEDs[led*3+2] = ( color >> 16 ) & 0xff; OutLEDs[led*3+2] = ( color >> 8 ) & 0xff;
led++; led++;
} }

View file

@ -53,13 +53,13 @@ static void DPOUpdate(void * id, struct NoteFinder*nf)
pts[5].x = cw + cos(angB) * sizeA; pts[5].x = cw + cos(angB) * sizeA;
pts[5].y = ch + sin(angB) * sizeA; pts[5].y = ch + sin(angB) * sizeA;
CNFGColor( OutLEDs[i*3+0] | (OutLEDs[i*3+1] <<8)|(OutLEDs[i*3+2] <<16) ); CNFGColor( ( OutLEDs[i*3+0] <<24) | (OutLEDs[i*3+1] <<16) | (OutLEDs[i*3+2] <<8) | 0xff );
CNFGTackPoly( pts, 3 ); CNFGTackPoly( pts, 3 );
CNFGTackPoly( pts+3, 3 ); CNFGTackPoly( pts+3, 3 );
} }
CNFGColor( 0xffffff ); CNFGColor( 0xffffffff );
} }
static void DPOParams(void * id ) static void DPOParams(void * id )

View file

@ -65,7 +65,7 @@ static void DPRUpdate(void * id, struct NoteFinder*nf)
CNFGTackPoly( pts+3, 3 ); CNFGTackPoly( pts+3, 3 );
CNFGColor( 0x00000000 ); CNFGColor( 0x000000ff );
CNFGTackSegment( p1x, p1y, p2x, p2y); CNFGTackSegment( p1x, p1y, p2x, p2y);
CNFGTackSegment( p2x, p2y, p4x, p4y); CNFGTackSegment( p2x, p2y, p4x, p4y);
CNFGTackSegment( p3x, p3y, p1x, p1y); CNFGTackSegment( p3x, p3y, p1x, p1y);
@ -114,7 +114,7 @@ static void DPRUpdate(void * id, struct NoteFinder*nf)
CNFGTackPoly( pts, 3 ); CNFGTackPoly( pts, 3 );
CNFGTackPoly( pts+3, 3 ); CNFGTackPoly( pts+3, 3 );
CNFGColor( 0x00000000 ); CNFGColor( 0x000000ff );
CNFGTackSegment( p1x, p1y, p2x, p2y); CNFGTackSegment( p1x, p1y, p2x, p2y);
CNFGTackSegment( p2x, p2y, p4x, p4y); CNFGTackSegment( p2x, p2y, p4x, p4y);
CNFGTackSegment( p3x, p3y, p1x, p1y); CNFGTackSegment( p3x, p3y, p1x, p1y);
@ -124,7 +124,7 @@ static void DPRUpdate(void * id, struct NoteFinder*nf)
CNFGColor( 0xffffff ); CNFGColor( 0xffffffff );
} }
static void DPRParams(void * id ) static void DPRParams(void * id )

View file

@ -187,9 +187,9 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
if( sendsat > 1 ) sendsat = 1; if( sendsat > 1 ) sendsat = 1;
int r = CCtoHEX( binpos[ia], 1.0, pow( sendsat, led->outgamma ) ); int r = CCtoHEX( binpos[ia], 1.0, pow( sendsat, led->outgamma ) );
OutLEDs[i*3+0] = r & 0xff; OutLEDs[i*3+0] = (r>>24) & 0xff;
OutLEDs[i*3+1] = (r>>8) & 0xff; OutLEDs[i*3+1] = (r>>16) & 0xff;
OutLEDs[i*3+2] = (r>>16) & 0xff; OutLEDs[i*3+2] = (r>>8) & 0xff;
} }
} }

View file

@ -180,9 +180,9 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
int r = CCtoHEX( led->last_led_pos[i], 1.0, pow( sendsat, led->outgamma ) ); int r = CCtoHEX( led->last_led_pos[i], 1.0, pow( sendsat, led->outgamma ) );
OutLEDs[i*3+0] = r & 0xff; OutLEDs[i*3+0] = (r>>24) & 0xff;
OutLEDs[i*3+1] = (r>>8) & 0xff; OutLEDs[i*3+1] = (r>>16) & 0xff;
OutLEDs[i*3+2] = (r>>16) & 0xff; OutLEDs[i*3+2] = (r>>8) & 0xff;
} }
if( led->is_loop ) if( led->is_loop )

View file

@ -43,18 +43,16 @@ static void LEDUpdate(void * id, struct NoteFinder*nf)
} }
} }
float sendsat = selected_amp;
if( sendsat > 1 ) sendsat = 1;
int r = CCtoHEX( selected_note, 1.0, sendsat );
//Advance the LEDs to this position when outputting the values. //Advance the LEDs to this position when outputting the values.
for( i = 0; i < led->total_leds; i++ ) for( i = 0; i < led->total_leds; i++ )
{ {
float sendsat = selected_amp; OutLEDs[i*3+0] = (r>>24) & 0xff;
if( sendsat > 1 ) sendsat = 1; OutLEDs[i*3+1] = (r>>16) & 0xff;
int r = CCtoHEX( selected_note, 1.0, sendsat ); OutLEDs[i*3+2] = (r>>8) & 0xff;
OutLEDs[i*3+0] = r & 0xff;
OutLEDs[i*3+1] = (r>>8) & 0xff;
OutLEDs[i*3+2] = (r>>16) & 0xff;
} }
} }

View file

@ -131,9 +131,9 @@ static void DPOUpdate(void * id, struct NoteFinder*nf)
color = CCtoHEX( note_color, 1.0, pow( sat, d->outgamma ) ); color = CCtoHEX( note_color, 1.0, pow( sat, d->outgamma ) );
} }
OutLEDs[led*3+0] = color & 0xff; OutLEDs[led*3+0] = ( color >> 24 ) & 0xff;
OutLEDs[led*3+1] = ( color >> 8 ) & 0xff; OutLEDs[led*3+1] = ( color >> 16 ) & 0xff;
OutLEDs[led*3+2] = ( color >> 16 ) & 0xff; OutLEDs[led*3+2] = ( color >> 8 ) & 0xff;
led++; led++;
} }
} }