From 63ef60ea93719c67fbf8da782ad1770f10d11719 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 14 Apr 2021 17:57:18 +0200 Subject: [PATCH] Fix formatting of `-inf' on some Windows systems Among others, this fixes tooltip display on aux-send faders --- libs/ardour/ardour/value_as_string.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/ardour/ardour/value_as_string.h b/libs/ardour/ardour/value_as_string.h index 2eab477ec8..84dfeb1cdf 100644 --- a/libs/ardour/ardour/value_as_string.h +++ b/libs/ardour/ardour/value_as_string.h @@ -54,7 +54,15 @@ value_as_string(const ARDOUR::ParameterDescriptor& desc, if (desc.unit == ARDOUR::ParameterDescriptor::MIDI_NOTE) { snprintf(buf, sizeof(buf), "%s", ParameterDescriptor::midi_note_name (rint(v)).c_str()); } else if (desc.type == GainAutomation || desc.type == BusSendLevel || desc.type == TrimAutomation || desc.type == EnvelopeAutomation || desc.type == MainOutVolume) { +#ifdef PLATFORM_WINDOWS + if (v < GAIN_COEFF_SMALL) { + snprintf(buf, sizeof(buf), "-inf dB"); + } else { + snprintf(buf, sizeof(buf), "%.2f dB", accurate_coefficient_to_dB (v)); + } +#else snprintf(buf, sizeof(buf), "%.2f dB", accurate_coefficient_to_dB (v)); +#endif } else if (desc.type == PanWidthAutomation) { snprintf (buf, sizeof (buf), "%d%%", (int) floor (100.0 * v)); } else if (!desc.print_fmt.empty()) {