X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Ffaderport%2Foperations.cc;h=ce6bb3e3d2e7e4fbdaa5f607db15adf2c743219f;hb=1aab360b7d944350dea1f5ef81394229adb07c1e;hp=e7f8284527619b8b416a9d79348f458a60311fad;hpb=aaebeb3d2b2f287cd6fed15d6077dbc6dda6ede7;p=ardour.git diff --git a/libs/surfaces/faderport/operations.cc b/libs/surfaces/faderport/operations.cc index e7f8284527..ce6bb3e3d2 100644 --- a/libs/surfaces/faderport/operations.cc +++ b/libs/surfaces/faderport/operations.cc @@ -22,6 +22,7 @@ #include "ardour/pannable.h" #include "ardour/plugin_insert.h" #include "ardour/rc_configuration.h" +#include "ardour/record_enable_control.h" #include "ardour/session.h" #include "ardour/track.h" #include "ardour/types.h" @@ -30,6 +31,7 @@ using namespace ARDOUR; using namespace ArdourSurface; +using namespace PBD; /* this value is chosen to given smooth motion from 0..1.0 in about 270 degrees * of encoder rotation. @@ -59,8 +61,8 @@ FaderPort::right () void FaderPort::read () { - if (_current_route) { - boost::shared_ptr gain = _current_route->gain_control (); + if (_current_stripable) { + boost::shared_ptr gain = _current_stripable->gain_control (); if (gain) { gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Play ); } @@ -70,8 +72,8 @@ FaderPort::read () void FaderPort::write () { - if (_current_route) { - boost::shared_ptr gain = _current_route->gain_control (); + if (_current_stripable) { + boost::shared_ptr gain = _current_stripable->gain_control (); if (gain) { gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Write ); } @@ -81,8 +83,8 @@ FaderPort::write () void FaderPort::touch () { - if (_current_route) { - boost::shared_ptr gain = _current_route->gain_control (); + if (_current_stripable) { + boost::shared_ptr gain = _current_stripable->gain_control (); if (gain) { gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Touch ); } @@ -92,8 +94,8 @@ FaderPort::touch () void FaderPort::off () { - if (_current_route) { - boost::shared_ptr gain = _current_route->gain_control (); + if (_current_stripable) { + boost::shared_ptr gain = _current_stripable->gain_control (); if (gain) { gain->set_automation_state( (ARDOUR::AutoState) ARDOUR::Off ); } @@ -118,72 +120,60 @@ FaderPort::redo () void FaderPort::mute () { - if (!_current_route) { + if (!_current_stripable) { return; } - if (_current_route == session->monitor_out()) { - boost::shared_ptr mp = _current_route->monitor_control(); + if (_current_stripable == session->monitor_out()) { + boost::shared_ptr mp = _current_stripable->monitor_control(); mp->set_cut_all (!mp->cut_all()); return; } - boost::shared_ptr rl (new RouteList); - rl->push_back (_current_route); - session->set_mute (rl, !_current_route->muted()); + _current_stripable->mute_control()->set_value (!_current_stripable->mute_control()->muted(), PBD::Controllable::UseGroup); } void FaderPort::solo () { - if (!_current_route) { + if (!_current_stripable) { return; } - boost::shared_ptr rl (new RouteList); - rl->push_back (_current_route); - - if (Config->get_solo_control_is_listen_control()) { - session->set_listen (rl, !_current_route->listening_via_monitor()); - } else { - session->set_solo (rl, !_current_route->soloed()); - } + _current_stripable->solo_control()->set_value (_current_stripable->solo_control()->soloed(), PBD::Controllable::UseGroup); } void FaderPort::rec_enable () { - if (!_current_route) { + if (!_current_stripable) { return; } - boost::shared_ptr t = boost::dynamic_pointer_cast(_current_route); + boost::shared_ptr t = boost::dynamic_pointer_cast(_current_stripable); if (!t) { return; } - boost::shared_ptr rl (new RouteList); - rl->push_back (_current_route); - - session->set_record_enabled (rl, !t->record_enabled()); + t->rec_enable_control()->set_value (!t->rec_enable_control()->get_value(), Controllable::UseGroup); } void FaderPort::use_master () { - boost::shared_ptr r = session->master_out(); + boost::shared_ptr r = session->master_out(); if (r) { - if (_current_route == r) { - r = pre_master_route.lock(); - set_current_route (r); + if (_current_stripable == r) { + r = pre_master_stripable.lock(); + set_current_stripable (r); get_button(Output).set_led_state (_output_port, false); blinkers.remove (Output); } else { - if (_current_route != session->master_out() && _current_route != session->monitor_out()) { - pre_master_route = boost::weak_ptr (_current_route); + if (_current_stripable != session->master_out() && _current_stripable != session->monitor_out()) { + pre_master_stripable = boost::weak_ptr (_current_stripable); } - set_current_route (r); + set_current_stripable (r); get_button(Output).set_led_state (_output_port, true); blinkers.remove (Output); } @@ -193,19 +183,19 @@ FaderPort::use_master () void FaderPort::use_monitor () { - boost::shared_ptr r = session->monitor_out(); + boost::shared_ptr r = session->monitor_out(); if (r) { - if (_current_route == r) { - r = pre_monitor_route.lock(); - set_current_route (r); + if (_current_stripable == r) { + r = pre_monitor_stripable.lock(); + set_current_stripable (r); get_button(Output).set_led_state (_output_port, false); blinkers.remove (Output); } else { - if (_current_route != session->master_out() && _current_route != session->monitor_out()) { - pre_monitor_route = boost::weak_ptr (_current_route); + if (_current_stripable != session->master_out() && _current_stripable != session->monitor_out()) { + pre_monitor_stripable = boost::weak_ptr (_current_stripable); } - set_current_route (r); + set_current_stripable (r); get_button(Output).set_led_state (_output_port, true); blinkers.push_back (Output); } @@ -216,11 +206,17 @@ FaderPort::use_monitor () void FaderPort::ardour_pan_azimuth (int delta) { - if (!_current_route) { + if (!_current_stripable) { + return; + } + + boost::shared_ptr r = boost::dynamic_pointer_cast (_current_stripable); + + if (!r) { return; } - boost::shared_ptr pannable = _current_route->pannable (); + boost::shared_ptr pannable = r->pannable (); if (!pannable) { return; @@ -232,18 +228,24 @@ FaderPort::ardour_pan_azimuth (int delta) return; } - azimuth->set_value (azimuth->interface_to_internal (azimuth->internal_to_interface (azimuth->get_value()) + (delta / encoder_divider))); + azimuth->set_value (azimuth->interface_to_internal (azimuth->internal_to_interface (azimuth->get_value()) + (delta / encoder_divider)), Controllable::NoGroup); } void FaderPort::ardour_pan_width(int delta) { - if (!_current_route) { + if (!_current_stripable) { return; } - boost::shared_ptr pannable = _current_route->pannable (); + boost::shared_ptr r = boost::dynamic_pointer_cast (_current_stripable); + + if (!r) { + return; + } + + boost::shared_ptr pannable = r->pannable (); if (!pannable) { return; @@ -255,19 +257,25 @@ FaderPort::ardour_pan_width(int delta) return; } - width->set_value (width->interface_to_internal (width->internal_to_interface (width->get_value()) + (delta / encoder_divider))); + width->set_value (width->interface_to_internal (width->internal_to_interface (width->get_value()) + (delta / encoder_divider)), Controllable::NoGroup); } void FaderPort::mixbus_pan (int delta) { #ifdef MIXBUS - if (!_current_route) { + if (!_current_stripable) { return; } + boost::shared_ptr r = boost::dynamic_pointer_cast (_current_stripable); + + if (!r) { + return; + } + const uint32_t port_channel_post_pan = 2; // gtk2_ardour/mixbus_ports.h - boost::shared_ptr plug = _current_route->ch_post(); + boost::shared_ptr plug = r->ch_post(); if (!plug) { return; @@ -279,7 +287,7 @@ FaderPort::mixbus_pan (int delta) return; } - azimuth->set_value (azimuth->interface_to_internal (azimuth->internal_to_interface (azimuth->get_value()) + (delta / encoder_divider))); + azimuth->set_value (azimuth->interface_to_internal (azimuth->internal_to_interface (azimuth->get_value()) + (delta / encoder_divider)), Controllable::NoGroup); #endif }