From dfa12dedcd1ccae61aab50d1f55a696df0b177d2 Mon Sep 17 00:00:00 2001 From: Franke Burgarino Date: Thu, 7 Aug 2025 10:59:15 -0500 Subject: [PATCH] MCU: make dynamics subview show actual values --- libs/surfaces/mackie/strip.cc | 11 +++++++++++ libs/surfaces/mackie/subview.cc | 6 +----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libs/surfaces/mackie/strip.cc b/libs/surfaces/mackie/strip.cc index 453b7a4808..a47dbb7cbc 100644 --- a/libs/surfaces/mackie/strip.cc +++ b/libs/surfaces/mackie/strip.cc @@ -719,6 +719,17 @@ Strip::remove_units (std::string s) { s = std::regex_replace (s, std::regex(" dB$"), ""); s = std::regex_replace (s, std::regex(" ms$"), ""); + // convert seconds to milliseconds + if (s.rfind(" s") != string::npos) { + char buf[32]; + s = std::regex_replace (s, std::regex(" s$"), ""); + if (sprintf(buf, "%2.0f", 1000.0*stof(s)) >= 0) { + s = std::string (buf); + } else { + DEBUG_TRACE (DEBUG::MackieControl, "couldn't convert string to float\n"); + } + } + return s; } diff --git a/libs/surfaces/mackie/subview.cc b/libs/surfaces/mackie/subview.cc index c9045e3de5..a4f8b82ac4 100644 --- a/libs/surfaces/mackie/subview.cc +++ b/libs/surfaces/mackie/subview.cc @@ -550,11 +550,7 @@ DynamicsSubview::notify_change (std::weak_ptr pc, uin if (control) { float val = control->get_value(); - if (control == _subview_stripable->mapped_control (Comp_Mode)) { - pending_display[1] = control->get_user_string (); - } else { - do_parameter_display(pending_display[1], control->desc(), val, strip, true); - } + pending_display[1] = Strip::remove_units(control->get_user_string()); /* update pot/encoder */ strip->surface()->write (vpot->set (control->internal_to_interface (val), true, Pot::wrap)); }