73 XWindowAttributes attrs;
74 XGetWindowAttributes(w->
app->
dpy, (Window)w->
widget, &attrs);
75 if (attrs.map_state != IsViewable)
return;
76 int width = attrs.width;
77 int height = attrs.height;
84 cairo_set_source_rgb(w->
crb,0.2,0.2,0.2);
91 float fvis = _get_tuner_temperament(w) * (log2f(value/xt->
ref_freq) + 4);
92 float fvisr = round(fvis);
94 int indicate_oc = round((fvisr+xt->
temp_adjust)/_get_tuner_temperament(w));
95 const int octsz =
sizeof(octave) /
sizeof(octave[0]);
96 if (indicate_oc < 0 || indicate_oc >= octsz) {
99 indicate_oc = octsz - 1;
102 scale = (fvis-vis) / 2;
103 vis = vis % _get_tuner_temperament(w);
105 vis += _get_tuner_temperament(w);
108 if (value > 24.0 && value < 999.0) {
110 cairo_set_source_rgb(w->
crb,0.80,0.79,0.01);
115 if (scale > -0.003) {
116 cairo_set_source_rgb(w->
crb,0.80,0.79,0.01);
123 cairo_set_source_rgba(w->
crb, fabsf(scale)*2, 1-(scale*scale*4), 0.2,1-(fabsf(scale)*2));
125 cairo_text_extents_t extents;
126 cairo_text_extents(w->
crb,_get_note_set(w)[vis] , &extents);
128 if (value > 24.0 && value < 999.0) {
129 float c = (extents.width/2)+10.0;
130 cairo_move_to(w->
crb,x0-c , y0 );
131 cairo_show_text(w->
crb, _get_note_set(w)[vis]);
133 cairo_move_to(w->
crb,x0+c-10.0, y0+ extents.height/2 );
134 cairo_show_text(w->
crb, octave[indicate_oc]);
137 const char* format[] = {
"%.1f Hz",
"%.2f Hz",
"%.3f Hz"};
138 snprintf(s, 63, format[2-1], value);
141 cairo_text_extents(w->
crb,s , &extents);
142 cairo_move_to (w->
crb, width/1.2-extents.width/2, height-extents.height );
143 cairo_show_text(w->
crb, s);