Update Ctrl Surfaces: use new well-known-ctrl API

This commit is contained in:
Robin Gareus 2024-01-13 03:08:51 +01:00
parent a7e36f77ac
commit 70a0b47cef
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
14 changed files with 400 additions and 410 deletions

View file

@ -26,6 +26,7 @@
#include "ardour/session.h"
#include "ardour/solo_control.h"
#include "ardour/solo_isolate_control.h"
#include "ardour/well_known_enum.h"
#include "launch_control_xl.h"
@ -95,9 +96,6 @@ LaunchControlXL::build_maps ()
MAKE_DM_KNOB (SendB6, 34, 13, GreenFull, GreenLow, boost::function<void ()>
(boost::bind (&LaunchControlXL::dm_mb_comp, this, SendB6, CompMakeup)),
boost::bind(&LaunchControlXL::dm_mb_comp_enabled,this));
MAKE_DM_KNOB (SendB7, 35, 14, GreenFull, GreenLow, boost::function<void ()>
(boost::bind (&LaunchControlXL::dm_mb_comp, this, SendB7, CompSpeed)),
boost::bind(&LaunchControlXL::dm_mb_comp_enabled, this));
MAKE_DM_KNOB (SendB8, 36, 15, GreenFull, GreenLow, boost::function<void ()>
(boost::bind (&LaunchControlXL::dm_mb_comp, this, SendB8, CompMode)),
boost::bind(&LaunchControlXL::dm_mb_comp_enabled, this));
@ -788,7 +786,7 @@ LaunchControlXL::knob_sendB(uint8_t n)
if (buttons_down.find(Device) != buttons_down.end()) { // Device button hold
#ifdef MIXBUS
ac = stripable[n]->filter_freq_controllable (true);
ac = stripable[n]->mapped_control (HPF_Freq);
#else
/* something */
#endif
@ -823,7 +821,7 @@ LaunchControlXL::knob_pan(uint8_t n)
if (buttons_down.find(Device) != buttons_down.end()) { // Device button hold
#ifdef MIXBUS
ac = stripable[n]->comp_threshold_controllable();
ac = stripable[n]->mapped_control (Comp_Threshold);
#else
ac = stripable[n]->pan_width_control();
#endif
@ -1278,8 +1276,8 @@ LaunchControlXL::dm_mb_eq_freq_enabled()
uint8_t dev_status = dev_nonexistant;
if (first_selected_stripable()->eq_enable_controllable()) {
if (first_selected_stripable()->eq_enable_controllable()->get_value()) {
if (first_selected_stripable()->mapped_control(EQ_Enable)) {
if (first_selected_stripable()->mapped_control(EQ_Enable)->get_value()) {
dev_status = dev_active;
} else {
dev_status = dev_inactive;
@ -1303,8 +1301,8 @@ LaunchControlXL::dm_mb_eq_gain_enabled(uint8_t band)
uint8_t dev_status = dev_nonexistant;
if (first_selected_stripable()->eq_enable_controllable()) {
if (first_selected_stripable()->eq_enable_controllable()->get_value()) {
if (first_selected_stripable()->mapped_control(EQ_Enable)) {
if (first_selected_stripable()->mapped_control(EQ_Enable)->get_value()) {
dev_status = dev_active;
} else {
dev_status = dev_inactive;
@ -1328,9 +1326,9 @@ LaunchControlXL::dm_mb_eq (KnobID k, bool gain, uint8_t band)
std::shared_ptr<AutomationControl> ac;
std::shared_ptr<Knob> knob = knob_by_id (k);
if (gain) {
ac = first_selected_stripable()->eq_gain_controllable(band);
ac = first_selected_stripable()->mapped_control(EQ_Gain, band);
} else {
ac = first_selected_stripable()->eq_freq_controllable(band);
ac = first_selected_stripable()->mapped_control (EQ_Freq, band);
}
if (ac && check_pick_up(knob, ac)) {
@ -1345,9 +1343,9 @@ LaunchControlXL::dm_mb_eq_shape_switch (uint8_t band)
return;
}
if (first_selected_stripable()->eq_shape_controllable(band)) {
first_selected_stripable()->eq_shape_controllable(band)->set_value
(!first_selected_stripable()->eq_shape_controllable(band)->get_value(), PBD::Controllable::NoGroup );
if (first_selected_stripable()->mapped_control (EQ_Shape, band)) {
first_selected_stripable()->mapped_control (EQ_Shape, band)->set_value
(!first_selected_stripable()->mapped_control (EQ_Shape, band)->get_value(), PBD::Controllable::NoGroup );
}
}
@ -1361,8 +1359,8 @@ LaunchControlXL::dm_mb_eq_shape_enabled(uint8_t band)
uint8_t dev_status = dev_nonexistant;
if (first_selected_stripable()->eq_shape_controllable(band)) {
if (first_selected_stripable()->eq_shape_controllable(band)->get_value()) {
if (first_selected_stripable()->mapped_control (EQ_Shape, band)) {
if (first_selected_stripable()->mapped_control (EQ_Shape, band)->get_value()) {
dev_status = dev_active;
} else {
dev_status = dev_inactive;
@ -1380,9 +1378,9 @@ LaunchControlXL::dm_mb_eq_switch()
return;
}
if (first_selected_stripable()->eq_enable_controllable()) {
first_selected_stripable()->eq_enable_controllable()->set_value
(!first_selected_stripable()->eq_enable_controllable()->get_value(), PBD::Controllable::NoGroup );
if (first_selected_stripable()->mapped_control(EQ_Enable)) {
first_selected_stripable()->mapped_control(EQ_Enable)->set_value
(!first_selected_stripable()->mapped_control(EQ_Enable)->get_value(), PBD::Controllable::NoGroup );
}
}
@ -1396,9 +1394,9 @@ LaunchControlXL::dm_mb_flt_enabled()
DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_mb_flt_enabled()\n");
uint8_t dev_status = dev_nonexistant;
if (first_selected_stripable()->filter_enable_controllable(true)) {
if (first_selected_stripable()->mapped_control (HPF_Enable)) {
DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_mb_flt_enabled() - filter exists\n");
if (first_selected_stripable()->filter_enable_controllable(true)->get_value()) {
if (first_selected_stripable()->mapped_control (HPF_Enable)->get_value()) {
DEBUG_TRACE (DEBUG::LaunchControlXL, "dm_mb_flt_enabled: get_value true\n");
dev_status = dev_active;
} else {
@ -1417,9 +1415,9 @@ LaunchControlXL::dm_mb_flt_switch()
return;
}
if (first_selected_stripable()->filter_enable_controllable(true)) {
first_selected_stripable()->filter_enable_controllable(true)->set_value
(!first_selected_stripable()->filter_enable_controllable(true)->get_value(), PBD::Controllable::NoGroup );
if (first_selected_stripable()->mapped_control (HPF_Enable)) {
first_selected_stripable()->mapped_control (HPF_Enable)->set_value
(!first_selected_stripable()->mapped_control (HPF_Enable)->get_value(), PBD::Controllable::NoGroup );
}
}
@ -1435,9 +1433,9 @@ LaunchControlXL::dm_mb_flt_frq (KnobID k, bool hpf)
std::shared_ptr<AutomationControl> ac;
std::shared_ptr<Knob> knob = knob_by_id (k);
if (hpf) {
ac = first_selected_stripable()->filter_freq_controllable(true);
ac = first_selected_stripable()->mapped_control (HPF_Freq);
} else {
ac = first_selected_stripable()->filter_freq_controllable(false);
ac = first_selected_stripable()->mapped_control (LPF_Freq);
}
if (ac && check_pick_up(knob, ac)) {
@ -1524,8 +1522,8 @@ LaunchControlXL::dm_mb_comp_enabled()
}
uint8_t dev_status = dev_nonexistant;
if (first_selected_stripable()->comp_enable_controllable()) {
if (first_selected_stripable()->comp_enable_controllable()->get_value()) {
if (first_selected_stripable()->mapped_control (Comp_Enable)) {
if (first_selected_stripable()->mapped_control (Comp_Enable)->get_value()) {
dev_status = dev_active;
} else {
dev_status = dev_inactive;
@ -1543,11 +1541,11 @@ LaunchControlXL::dm_mb_comp_switch()
return;
}
if (first_selected_stripable()->comp_enable_controllable()) {
if (first_selected_stripable()->mapped_control (Comp_Enable)) {
DEBUG_TRACE (DEBUG::LaunchControlXL, "comp_enable_controllable exists\n");
DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("comp_enable_controllable(): '%1'\n", first_selected_stripable()->comp_enable_controllable()->get_value() ));
first_selected_stripable()->comp_enable_controllable()->set_value
(!first_selected_stripable()->comp_enable_controllable()->get_value(), PBD::Controllable::NoGroup);
DEBUG_TRACE (DEBUG::LaunchControlXL, string_compose("mapped_control (Comp_Enable): '%1'\n", first_selected_stripable()->mapped_control (Comp_Enable)->get_value() ));
first_selected_stripable()->mapped_control (Comp_Enable)->set_value
(!first_selected_stripable()->mapped_control (Comp_Enable)->get_value(), PBD::Controllable::NoGroup);
}
}
@ -1564,13 +1562,10 @@ LaunchControlXL::dm_mb_comp (KnobID k, CompParam c)
switch (c) {
case (CompMakeup):
ac = first_selected_stripable()->comp_makeup_controllable();
ac = first_selected_stripable()->mapped_control (Comp_Makeup);
break;
case (CompMode):
ac = first_selected_stripable()->comp_mode_controllable();
break;
case (CompSpeed):
ac = first_selected_stripable()->comp_speed_controllable();
ac = first_selected_stripable()->mapped_control (Comp_Mode);
break;
}
@ -1595,7 +1590,7 @@ LaunchControlXL::dm_mb_comp_thresh (FaderID id) {
fader = f->second;
}
ac = first_selected_stripable()->comp_threshold_controllable();
ac = first_selected_stripable()->mapped_control (Comp_Threshold);
if (ac && check_pick_up(fader, ac)) {
ac->set_value ( ac->interface_to_internal( fader->value() / 127.0), PBD::Controllable::UseGroup );
}
@ -1627,7 +1622,7 @@ LaunchControlXL::dm_mb_tapedrive (KnobID k)
std::shared_ptr<AutomationControl> ac;
std::shared_ptr<Knob> knob = knob_by_id (k);
ac = first_selected_stripable()->tape_drive_controllable();
ac = first_selected_stripable()->mapped_control (TapeDrive_Drive);
if (ac && check_pick_up(knob, ac)) {
ac->set_value ( ac->interface_to_internal( knob->value() / 127.0), PBD::Controllable::UseGroup );