From 1d9c2004beb856a6f41a0d375b35b2987f11f63c Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 14 Mar 2023 17:27:05 +0100 Subject: [PATCH] Backport Mixbus9 well-known ctrls This also removes the mixbus specific implementation from ardour's codebase --- libs/ardour/ardour/route.h | 26 +++ libs/ardour/route.cc | 453 ++++++++++--------------------------- 2 files changed, 151 insertions(+), 328 deletions(-) diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h index 20d565ff1f..51db82943c 100644 --- a/libs/ardour/ardour/route.h +++ b/libs/ardour/ardour/route.h @@ -548,7 +548,9 @@ public: boost::shared_ptr filter_slope_controllable (bool) const; boost::shared_ptr filter_enable_controllable (bool) const; + std::string tape_mode_name (uint32_t) const; boost::shared_ptr tape_drive_controllable () const; + boost::shared_ptr tape_drive_mode_controllable () const; boost::shared_ptr tape_drive_mtr_controllable () const; boost::shared_ptr comp_enable_controllable () const; @@ -556,8 +558,32 @@ public: boost::shared_ptr comp_speed_controllable () const; boost::shared_ptr comp_mode_controllable () const; boost::shared_ptr comp_makeup_controllable () const; + boost::shared_ptr comp_ratio_controllable () const; + boost::shared_ptr comp_attack_controllable () const; + boost::shared_ptr comp_release_controllable () const; + boost::shared_ptr comp_key_filter_freq_controllable () const; + boost::shared_ptr comp_lookahead_controllable () const; + boost::shared_ptr comp_meter_controllable () const; boost::shared_ptr comp_redux_controllable () const; + std::string gate_mode_name (uint32_t) const; + boost::shared_ptr gate_enable_controllable () const; + boost::shared_ptr gate_mode_controllable () const; + boost::shared_ptr gate_ratio_controllable () const; + boost::shared_ptr gate_knee_controllable () const; + boost::shared_ptr gate_threshold_controllable () const; + boost::shared_ptr gate_depth_controllable () const; + boost::shared_ptr gate_hysteresis_controllable () const; + boost::shared_ptr gate_hold_controllable () const; + boost::shared_ptr gate_attack_controllable () const; + boost::shared_ptr gate_release_controllable () const; + boost::shared_ptr gate_key_listen_controllable () const; + boost::shared_ptr gate_key_filter_enable_controllable () const; + boost::shared_ptr gate_key_filter_freq_controllable () const; + boost::shared_ptr gate_lookahead_controllable () const; + boost::shared_ptr gate_meter_controllable () const; + boost::shared_ptr gate_redux_controllable () const; + std::string comp_mode_name (uint32_t mode) const; std::string comp_speed_name (uint32_t mode) const; diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index b373049344..78a248c9ca 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -1311,11 +1311,9 @@ Route::ab_plugins (bool forward) if (!(*i)->display_to_user () || is_internal_processor (*i)) { continue; } -#ifdef MIXBUS if (boost::dynamic_pointer_cast (*i)->is_channelstrip()) { continue; } -#endif if ((*i)->enabled ()) { (*i)->enable (false); @@ -1336,11 +1334,9 @@ Route::ab_plugins (bool forward) if (!(*i)->display_to_user () || is_internal_processor (*i)) { continue; } -#ifdef MIXBUS if (boost::dynamic_pointer_cast (*i)->is_channelstrip()) { continue; } -#endif (*i)->enable ((*i)->get_next_ab_is_active ()); } @@ -1435,11 +1431,6 @@ Route::is_internal_processor (boost::shared_ptr p) const if (p == _amp || p == _meter || p == _main_outs || p == _delayline || p == _trim || p == _polarity || (_volume && p == _volume) || (_triggerbox && p == _triggerbox)) { return true; } -#ifdef MIXBUS - if (p == _ch_pre || p == _ch_post || p == _ch_eq || p == _ch_comp) { - return true; - } -#endif return false; } @@ -2059,14 +2050,12 @@ Route::all_visible_processors_active (bool state) if (!(*i)->display_to_user () || is_internal_processor (*i)) { continue; } -#ifdef MIXBUS boost::shared_ptr pi; if (0 != (pi = boost::dynamic_pointer_cast(*i))) { if (pi->is_channelstrip ()) { continue; } } -#endif (*i)->enable (state); } @@ -5696,17 +5685,10 @@ Route::fill_buffers_with_input (BufferSet& bufs, boost::shared_ptr io, pfram boost::shared_ptr Route::pan_azimuth_control() const { -#ifdef MIXBUS - if (_mixbus_send) { - return _mixbus_send->master_pan_ctrl (); - } - return boost::shared_ptr(); -#else if (!_pannable || !panner()) { return boost::shared_ptr(); } return _pannable->pan_azimuth_control; -#endif } boost::shared_ptr @@ -5727,12 +5709,6 @@ Route::pan_elevation_control() const boost::shared_ptr Route::pan_width_control() const { -#ifdef MIXBUS - if (mixbus() && _ch_pre) { - //mono blend - return boost::dynamic_pointer_cast(_ch_pre->control(Evoral::Parameter(PluginAutomation, 0, 1))); - } -#endif if (Profile->get_mixbus() || !_pannable || !panner()) { return boost::shared_ptr(); } @@ -5779,106 +5755,19 @@ Route::pan_lfe_control() const uint32_t Route::eq_band_cnt () const { - if (Profile->get_mixbus()) { -#ifdef MIXBUS32C - if (is_master() || mixbus()) { - return 3; - } else { - return 4; - } -#else - return 3; -#endif - } else { - /* Ardour has no well-known EQ object */ - return 0; - } + /* Ardour has no well-known EQ object */ + return 0; } boost::shared_ptr Route::eq_gain_controllable (uint32_t band) const { -#ifdef MIXBUS - boost::shared_ptr eq = _ch_eq; - - if (!eq) { - return boost::shared_ptr(); - } - - uint32_t port_number; - if (is_master() || mixbus()) { - switch (band) { - case 0: port_number = 4; break; - case 1: port_number = 3; break; - case 2: port_number = 2; break; - default: - return boost::shared_ptr(); - } - } else { -#ifdef MIXBUS32C - switch (band) { - case 0: port_number = 14; break; - case 1: port_number = 12; break; - case 2: port_number = 10; break; - case 3: port_number = 8; break; - default: - return boost::shared_ptr(); - } -#else - switch (band) { - case 0: port_number = 8; break; - case 1: port_number = 6; break; - case 2: port_number = 4; break; - default: - return boost::shared_ptr(); - } -#endif - } - - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, port_number))); -#else return boost::shared_ptr(); -#endif } boost::shared_ptr Route::eq_freq_controllable (uint32_t band) const { -#ifdef MIXBUS - if (mixbus() || is_master()) { - /* no frequency controls for mixbusses or master */ - return boost::shared_ptr(); - } - - boost::shared_ptr eq = _ch_eq; - - if (!eq) { - return boost::shared_ptr(); - } - - uint32_t port_number; -#ifdef MIXBUS32C - switch (band) { - case 0: port_number = 13; break; // lo - case 1: port_number = 11; break; // lo mid - case 2: port_number = 9; break; // hi mid - case 3: port_number = 7; break; // hi - default: - return boost::shared_ptr(); - } -#else - switch (band) { - case 0: port_number = 7; break; - case 1: port_number = 5; break; - case 2: port_number = 3; break; - default: - return boost::shared_ptr(); - } -#endif - - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, port_number))); -#else return boost::shared_ptr(); -#endif } boost::shared_ptr @@ -5890,66 +5779,19 @@ Route::eq_q_controllable (uint32_t band) const boost::shared_ptr Route::eq_shape_controllable (uint32_t band) const { -#ifdef MIXBUS32C - if (is_master() || mixbus() || !eq) { - return boost::shared_ptr(); - } - switch (band) { - case 0: - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 4))); // lo bell - break; - case 3: - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 3))); // hi bell - break; - default: - break; - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::eq_enable_controllable () const { -#ifdef MIXBUS - boost::shared_ptr eq = _ch_eq; - - if (!eq) { - return boost::shared_ptr(); - } - - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 1))); -#else return boost::shared_ptr(); -#endif } boost::shared_ptr Route::filter_freq_controllable (bool hpf) const { -#ifdef MIXBUS - boost::shared_ptr eq = _ch_eq; - - if (is_master() || mixbus() || !eq) { - return boost::shared_ptr(); - } - if (hpf) { -#ifdef MIXBUS32C - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 5))); // HPF freq -#else - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 2))); -#endif - } else { -#ifdef MIXBUS32C - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 6))); // LPF freq -#else - return boost::shared_ptr(); -#endif - } - -#else return boost::shared_ptr(); -#endif } boost::shared_ptr @@ -5961,239 +5803,226 @@ Route::filter_slope_controllable (bool) const boost::shared_ptr Route::filter_enable_controllable (bool) const { -#ifdef MIXBUS32C - boost::shared_ptr eq = _ch_eq; - - if (is_master() || mixbus() || !eq) { - return boost::shared_ptr(); - } - - return boost::dynamic_pointer_cast (eq->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 2))); -#else return boost::shared_ptr(); -#endif +} + +std::string +Route::tape_mode_name (uint32_t mode) const +{ + return _("???"); } boost::shared_ptr Route::tape_drive_controllable () const { -#ifdef MIXBUS - if (_ch_pre) { - return boost::dynamic_pointer_cast (_ch_pre->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 0))); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::tape_drive_mtr_controllable () const { -#ifdef MIXBUS - if (_ch_pre) { - return _ch_pre->control_output (is_master() ? 1 : 2); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::master_correlation_mtr_controllable (bool mm) const { -#ifdef MIXBUS - if (is_master() && _ch_post) { - return _ch_post->control_output (mm ? 4 : 3); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::master_limiter_enable_controllable () const { -#ifdef MIXBUS - if (is_master() && _ch_post) { - return boost::dynamic_pointer_cast (_ch_post->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 1))); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::master_limiter_mtr_controllable () const { -#ifdef MIXBUS - if (is_master() && _ch_post) { - return _ch_post->control_output (2); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::master_k_mtr_controllable () const { -#ifdef MIXBUS - if (is_master() && _ch_post) { - return _ch_post->control_output (5); - } -#endif return boost::shared_ptr(); } string Route::eq_band_name (uint32_t band) const { -#ifdef MIXBUS32C - if (is_master() || mixbus()) { -#endif - if (Profile->get_mixbus()) { - switch (band) { - case 0: return _("lo"); - case 1: return _("mid"); - case 2: return _("hi"); - default: return string(); - } - } else { - return string (); - } -#ifdef MIXBUS32C - } else { - switch (band) { - case 0: return _("lo"); - case 1: return _("lm"); - case 2: return _("hm"); - case 3: return _("hi"); - default: return string(); - } - } -#endif + return string (); } boost::shared_ptr Route::comp_enable_controllable () const { -#ifdef MIXBUS - if (_ch_comp) { - return boost::dynamic_pointer_cast (_ch_comp->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 1))); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::comp_threshold_controllable () const { -#ifdef MIXBUS - if (_ch_comp) { - return boost::dynamic_pointer_cast (_ch_comp->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 2))); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::comp_speed_controllable () const { -#ifdef MIXBUS - if (_ch_comp) { - return boost::dynamic_pointer_cast (_ch_comp->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 3))); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::comp_mode_controllable () const { -#ifdef MIXBUS - if (_ch_comp) { - return boost::dynamic_pointer_cast (_ch_comp->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 4))); - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::comp_makeup_controllable () const { -#ifdef MIXBUS - if (_ch_comp) { - return boost::dynamic_pointer_cast (_ch_comp->control (Evoral::Parameter (ARDOUR::PluginAutomation, 0, 5))); - } -#endif return boost::shared_ptr(); } +boost::shared_ptr +Route::comp_ratio_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::comp_attack_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::comp_release_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::comp_key_filter_freq_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::comp_lookahead_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::comp_meter_controllable () const +{ + return boost::shared_ptr(); +} boost::shared_ptr Route::comp_redux_controllable () const { -#ifdef MIXBUS - if (_ch_comp) { - return _ch_comp->control_output (6); - } -#endif return boost::shared_ptr(); } string Route::comp_mode_name (uint32_t mode) const { -#ifdef MIXBUS - switch (mode) { - case 0: - return _("Leveler"); - case 1: - return _("Compressor"); - case 2: - return _("Limiter"); - case 3: - return mixbus() ? _("Sidechain") : _("Limiter"); - } - return _("???"); -#else - return _("???"); -#endif } string Route::comp_speed_name (uint32_t mode) const { -#ifdef MIXBUS - switch (mode) { - case 0: - return _("Attk"); - case 1: - return _("Ratio"); - case 2: - case 3: - return _("Rels"); - } return _("???"); -#else +} + +string +Route::gate_mode_name (uint32_t mode) const +{ return _("???"); -#endif +} + +boost::shared_ptr +Route::gate_enable_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_mode_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_ratio_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_knee_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_threshold_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_depth_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_hysteresis_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_hold_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_attack_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_release_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_key_listen_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_key_filter_enable_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_key_filter_freq_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_lookahead_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_meter_controllable () const +{ + return boost::shared_ptr(); +} +boost::shared_ptr +Route::gate_redux_controllable () const +{ + return boost::shared_ptr(); } boost::shared_ptr Route::send_pan_azimuth_controllable (uint32_t n) const { -#ifdef MIXBUS - if (_mixbus_send) { - if (n < _mixbus_send->n_busses ()) { - return _mixbus_send->send_pan_ctrl (n + 1); - } - } -#endif return boost::shared_ptr(); } boost::shared_ptr Route::send_level_controllable (uint32_t n) const { -#ifdef MIXBUS - if (_mixbus_send) { - if (n < _mixbus_send->n_busses ()) { - return _mixbus_send->send_gain_ctrl (n + 1); - } - n -= _mixbus_send->n_busses (); - } -#endif boost::shared_ptr s = boost::dynamic_pointer_cast(nth_send (n)); if (s) { return s->gain_control (); @@ -6204,13 +6033,6 @@ Route::send_level_controllable (uint32_t n) const boost::shared_ptr Route::send_enable_controllable (uint32_t n) const { -#ifdef MIXBUS - if (_mixbus_send) { - if (n < _mixbus_send->n_busses ()) { - return _mixbus_send->send_enable_ctrl (n + 1); - } - } -#endif /* although Ardour sends have enable/disable as part of the Processor * API, it is not exposed as a controllable. * @@ -6222,27 +6044,12 @@ Route::send_enable_controllable (uint32_t n) const boost::shared_ptr Route::send_pan_azimuth_enable_controllable (uint32_t n) const { -#ifdef MIXBUS - if (_mixbus_send) { - if (n < _mixbus_send->n_busses ()) { - return _mixbus_send->send_pan_enable_ctrl (n + 1); - } - } -#endif return boost::shared_ptr(); } string Route::send_name (uint32_t n) const { -#ifdef MIXBUS - if (_mixbus_send) { - if (n < _mixbus_send->n_busses ()) { - return _session.get_mixbus (n)->name(); - } - n -= _mixbus_send->n_busses (); - } -#endif boost::shared_ptr p = nth_send (n); if (p) { return p->name(); @@ -6253,16 +6060,6 @@ Route::send_name (uint32_t n) const boost::shared_ptr Route::master_send_enable_controllable () const { -#ifdef MIXBUS - if (is_master() || is_monitor() || is_auditioner()) { - return boost::shared_ptr(); - } - - if (_mixbus_send) { - return _mixbus_send->master_send_enable_ctrl (); - } - -#endif return boost::shared_ptr(); }