X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fsurfaces%2Fcontrol_protocol%2Fcontrol_protocol.cc;h=f1b2f9f112b97f9cf3a434df2e5d520066a3cf6c;hb=291aec468fe4646aa1e355f2503d349555019e54;hp=6d016359bb3a15192e3afb14d62226c20c7732a5;hpb=9e5b7db89f381c70232fab35dc21fd885863f998;p=ardour.git diff --git a/libs/surfaces/control_protocol/control_protocol.cc b/libs/surfaces/control_protocol/control_protocol.cc index 6d016359bb..f1b2f9f112 100644 --- a/libs/surfaces/control_protocol/control_protocol.cc +++ b/libs/surfaces/control_protocol/control_protocol.cc @@ -22,6 +22,7 @@ #include "ardour/gain_control.h" #include "ardour/session.h" +#include "ardour/record_enable_control.h" #include "ardour/route.h" #include "ardour/audio_track.h" #include "ardour/meter.h" @@ -45,15 +46,11 @@ PBD::Signal0 ControlProtocol::VerticalZoomInAll; PBD::Signal0 ControlProtocol::VerticalZoomOutAll; PBD::Signal0 ControlProtocol::VerticalZoomInSelected; PBD::Signal0 ControlProtocol::VerticalZoomOutSelected; -PBD::Signal1 ControlProtocol::TrackSelectionChanged; -PBD::Signal1 ControlProtocol::AddRouteToSelection; -PBD::Signal1 ControlProtocol::SetRouteSelection; -PBD::Signal1 ControlProtocol::ToggleRouteSelection; -PBD::Signal1 ControlProtocol::RemoveRouteFromSelection; -PBD::Signal0 ControlProtocol::ClearRouteSelection; PBD::Signal0 ControlProtocol::StepTracksDown; PBD::Signal0 ControlProtocol::StepTracksUp; +PBD::Signal1 ControlProtocol::StripableSelectionChanged; + const std::string ControlProtocol::state_node_name ("Protocol"); ControlProtocol::ControlProtocol (Session& s, string str) @@ -77,82 +74,18 @@ ControlProtocol::set_active (bool yn) void ControlProtocol::next_track (uint32_t initial_id) { - uint32_t limit = session->nroutes(); - boost::shared_ptr cr = route_table[0]; - uint32_t id; - - if (cr) { - id = cr->remote_control_id (); - } else { - id = 0; - } - - if (id == limit) { - id = 0; - } else { - id++; - } - - while (id <= limit) { - if ((cr = session->route_by_remote_id (id)) != 0) { - break; - } - id++; - } - - if (id >= limit) { - id = 0; - while (id != initial_id) { - if ((cr = session->route_by_remote_id (id)) != 0) { - break; - } - id++; - } - } - - route_table[0] = cr; + // STRIPABLE route_table[0] = _session->get_nth_stripable (++initial_id, RemoteControlID::Route); } void ControlProtocol::prev_track (uint32_t initial_id) { - uint32_t limit = session->nroutes(); - boost::shared_ptr cr = route_table[0]; - int32_t id; - - if (cr) { - id = cr->remote_control_id (); - } else { - id = 0; - } - - if (id == 0) { - id = limit; - } else { - id--; - } - - while (id >= 0) { - if ((cr = session->route_by_remote_id (id)) != 0) { - break; - } - id--; - } - - if (id < 0) { - uint32_t i = limit; - while (i > initial_id) { - if ((cr = session->route_by_remote_id (i)) != 0) { - break; - } - i--; - } + if (!initial_id) { + return; } - - route_table[0] = cr; + // STRIPABLE route_table[0] = _session->get_nth_stripable (--initial_id, RemoteControlID::Route); } - void ControlProtocol::set_route_table_size (uint32_t size) { @@ -176,6 +109,7 @@ ControlProtocol::set_route_table (uint32_t table_index, boost::shared_ptr r = session->route_by_remote_id (remote_control_id); if (!r) { @@ -183,7 +117,7 @@ ControlProtocol::set_route_table (uint32_t table_index, uint32_t remote_control_ } set_route_table (table_index, r); - +#endif return true; } @@ -199,7 +133,7 @@ ControlProtocol::route_set_rec_enable (uint32_t table_index, bool yn) boost::shared_ptr at = boost::dynamic_pointer_cast(r); if (at) { - at->set_record_enabled (yn, Controllable::NoGroup); + at->rec_enable_control()->set_value (1.0, Controllable::UseGroup); } } @@ -215,7 +149,7 @@ ControlProtocol::route_get_rec_enable (uint32_t table_index) boost::shared_ptr at = boost::dynamic_pointer_cast(r); if (at) { - return at->record_enabled (); + return at->rec_enable_control()->get_value(); } return false; @@ -235,7 +169,7 @@ ControlProtocol::route_get_gain (uint32_t table_index) return 0.0f; } - return r->amp()->gain (); + return r->gain_control()->get_value(); } void @@ -248,7 +182,7 @@ ControlProtocol::route_set_gain (uint32_t table_index, float gain) boost::shared_ptr r = route_table[table_index]; if (r != 0) { - r->set_gain (gain, Controllable::UseGroup); + r->gain_control()->set_value (gain, Controllable::UseGroup); } } @@ -282,10 +216,9 @@ ControlProtocol::route_get_peak_input_power (uint32_t table_index, uint32_t whic return 0.0f; } - return r->peak_meter().meter_level (which_input, MeterPeak); + return r->peak_meter()->meter_level (which_input, MeterPeak); } - bool ControlProtocol::route_get_muted (uint32_t table_index) { @@ -299,7 +232,7 @@ ControlProtocol::route_get_muted (uint32_t table_index) return false; } - return r->muted (); + return r->mute_control()->muted (); } void @@ -312,7 +245,7 @@ ControlProtocol::route_set_muted (uint32_t table_index, bool yn) boost::shared_ptr r = route_table[table_index]; if (r != 0) { - r->set_mute (yn, Controllable::UseGroup); + r->mute_control()->set_value (yn ? 1.0 : 0.0, Controllable::UseGroup); } } @@ -343,7 +276,7 @@ ControlProtocol::route_set_soloed (uint32_t table_index, bool yn) boost::shared_ptr r = route_table[table_index]; if (r != 0) { - r->set_solo (yn, Controllable::UseGroup); + r->solo_control()->set_value (yn ? 1.0 : 0.0, Controllable::UseGroup); } }