13
0

Fix sample-rate display rounding for 22.05kHz

Thanks to Colin Fletcher
This commit is contained in:
Robin Gareus 2024-09-29 18:07:59 +02:00
parent c6ef4c3545
commit d60e0e7ade
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -770,7 +770,9 @@ string
ARDOUR_UI_UTILS::rate_as_string (float r) ARDOUR_UI_UTILS::rate_as_string (float r)
{ {
char buf[32]; char buf[32];
if (fmod (r, 1000.0f)) { if (fmod (r, 100.0f)) {
snprintf (buf, sizeof (buf), "%.2f kHz", r / 1000.0);
} else if (fmod (r, 1000.0f)) {
snprintf (buf, sizeof (buf), "%.1f kHz", r / 1000.0); snprintf (buf, sizeof (buf), "%.1f kHz", r / 1000.0);
} else { } else {
snprintf (buf, sizeof (buf), "%.0f kHz", r / 1000.0); snprintf (buf, sizeof (buf), "%.0f kHz", r / 1000.0);