MCU: make dynamics subview show actual values

This commit is contained in:
Franke Burgarino 2025-08-07 10:59:15 -05:00
parent b5f1c5b0dd
commit dfa12dedcd
2 changed files with 12 additions and 5 deletions

View file

@ -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;
}

View file

@ -550,11 +550,7 @@ DynamicsSubview::notify_change (std::weak_ptr<ARDOUR::AutomationControl> 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));
}