Sequencer: Use a 3 break gradient for velocity colors.

This commit is contained in:
Jonathan Moore Liles 2020-10-29 21:41:09 -07:00
parent 5ea0c24468
commit 368492f1c0
1 changed files with 13 additions and 6 deletions

View File

@ -99,13 +99,20 @@ Function {init_colors()} {open private C return_type {static void}
code {unsigned int i;
/* velocity colors */
Fl_Color lo = fl_color_average( FL_CYAN, FL_BLACK, 0.10 );
Fl_Color hi = fl_color_average( FL_CYAN, FL_WHITE, 0.80 );
for ( i = 128; i--; )
{
velocity_colors[i] = fl_color_average( hi, lo, 1.0 * ((float)i / 128) );
}} {}
Fl_Color c[] = { FL_BLUE, FL_GREEN, FL_RED };
int b[] = {0, 64, 127 };
int nbreaks = 3;
for ( int i = 0; i < nbreaks - 1; i++ )
{
int k = 0;
for ( int j = b[i]; j <= b[i+1]; j++, k++ )
velocity_colors[ j ] = fl_color_average( c[i+1], c[i], ( k ) / (float)(b[i+1] - b[i] ));
}
} {}
}
widget_class Visual_Metronome {open