MCU: move creation of dynamics subview 'available' parameters list to seperate function

'available' was being created and deleted every time setup_vpot was
called. now it is only created when making the subview or switching the
dynamics type
This commit is contained in:
Franke Burgarino
2025-08-11 15:05:56 -05:00
parent 92267ec7db
commit 588fbee13b
3 changed files with 22 additions and 16 deletions

View File

@@ -353,6 +353,7 @@ void
Strip::notify_subview_type_changed ()
{
if (_stripable) {
_surface->mcp().subview()->init_params();
_surface->mcp().MackieControlProtocol::redisplay_subview_mode();
}
}

View File

@@ -69,8 +69,11 @@ std::shared_ptr<Subview> SubviewFactory::create_subview(
switch (svm) {
case Subview::EQ:
return std::shared_ptr<EQSubview>(new EQSubview (mcp, subview_stripable));
case Subview::Dynamics:
return std::shared_ptr<DynamicsSubview>(new DynamicsSubview (mcp, subview_stripable));
case Subview::Dynamics: {
auto subview = std::shared_ptr<DynamicsSubview>(new DynamicsSubview (mcp, subview_stripable));
subview->init_params();
return subview;
}
case Subview::Sends:
return std::shared_ptr<SendsSubview>(new SendsSubview (mcp, subview_stripable));
case Subview::TrackView:
@@ -480,18 +483,7 @@ void DynamicsSubview::update_global_buttons()
_mcp.update_global_button (Button::Pan, off);
}
void DynamicsSubview::setup_vpot(
Strip* strip,
Pot* vpot,
std::string pending_display[2])
{
const uint32_t global_strip_position = _mcp.global_index (*strip) + _current_bank;
store_pointers(strip, vpot, pending_display, global_strip_position - _current_bank);
if (!_subview_stripable) {
return;
}
void DynamicsSubview::init_params() {
available.clear();
std::shared_ptr<AutomationControl> cec = _subview_stripable->mapped_control (Comp_Enable);
@@ -511,8 +503,6 @@ void DynamicsSubview::setup_vpot(
* order shown above.
*/
std::vector<AutomationType> params;
if (cec) { available.push_back (std::make_pair (cec, "Comp")); }
if (ctc) { available.push_back (std::make_pair (ctc, "CThrsh")); }
if (crc) { available.push_back (std::make_pair (crc, "CRatio")); }
@@ -525,6 +515,19 @@ void DynamicsSubview::setup_vpot(
if (gdc) { available.push_back (std::make_pair (gdc, "GDepth")); }
if (gac) { available.push_back (std::make_pair (gac, "GAttk")); }
if (gsc) { available.push_back (std::make_pair (gsc, "GRels")); }
}
void DynamicsSubview::setup_vpot(
Strip* strip,
Pot* vpot,
std::string pending_display[2])
{
const uint32_t global_strip_position = _mcp.global_index (*strip) + _current_bank;
store_pointers(strip, vpot, pending_display, global_strip_position - _current_bank);
if (!_subview_stripable) {
return;
}
if (global_strip_position >= available.size()) {
/* this knob is not needed to control the available parameters */

View File

@@ -61,6 +61,7 @@ class Subview {
virtual Mode subview_mode () const = 0;
virtual void update_global_buttons() = 0;
virtual bool permit_flipping_faders_and_pots() { return false; }
virtual void init_params(){}
virtual void setup_vpot(
Strip* strip,
Pot* vpot,
@@ -141,6 +142,7 @@ class DynamicsSubview : public Subview {
virtual Subview::Mode subview_mode () const { return Subview::Dynamics; }
static bool subview_mode_would_be_ok (std::shared_ptr<ARDOUR::Stripable> r, std::string& reason_why_not);
virtual void update_global_buttons();
virtual void init_params();
virtual void setup_vpot(
Strip* strip,
Pot* vpot,