From d60e0e7ade063e8f18a9fc5012e9eec129aa91ec Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 29 Sep 2024 18:07:59 +0200 Subject: [PATCH] Fix sample-rate display rounding for 22.05kHz Thanks to Colin Fletcher --- gtk2_ardour/utils.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index 1bf895d938..84d2c40b0b 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -770,7 +770,9 @@ string ARDOUR_UI_UTILS::rate_as_string (float r) { 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); } else { snprintf (buf, sizeof (buf), "%.0f kHz", r / 1000.0);