Update gain widget to show no decimal places for scale > 0.5

The 4th Gen input gain control scale is 69/70 which is close enough to
1 that we don't need to display any decimal places.
This commit is contained in:
Geoffrey D. Bennett
2024-03-24 22:34:31 +10:30
parent 382524bf01
commit d86fd23a57
+2 -2
View File
@@ -70,12 +70,12 @@ static void gain_updated(
p += sprintf(p, "−"); p += sprintf(p, "−");
else if (value > 0) else if (value > 0)
p += sprintf(p, "+"); p += sprintf(p, "+");
if (data->scale < 1) if (data->scale <= 0.5)
p += sprintf(p, "%.1f", fabs(value)); p += sprintf(p, "%.1f", fabs(value));
else else
p += sprintf(p, "%.0f", fabs(value)); p += sprintf(p, "%.0f", fabs(value));
} }
if (data->scale >= 1) if (data->scale > 0.5)
p += sprintf(p, "dB"); p += sprintf(p, "dB");
gtk_label_set_text(GTK_LABEL(data->label), s); gtk_label_set_text(GTK_LABEL(data->label), s);