Add BasicUI::set_control() and set_controls()

Towards removing the direct use of Session by surfaces.
This commit is contained in:
David Robillard 2021-06-16 01:37:23 -04:00
parent cbbc6f66ee
commit fad1531b2d
8 changed files with 41 additions and 12 deletions

View file

@ -847,6 +847,24 @@ BasicUI::config ()
return _session->config;
}
void
BasicUI::set_controls (
boost::shared_ptr<ControlList> control_list,
const double val,
const PBD::Controllable::GroupControlDisposition disposition)
{
return _session->set_controls (control_list, val, disposition);
}
void
BasicUI::set_control (
boost::shared_ptr<AutomationControl> control,
const double val,
const PBD::Controllable::GroupControlDisposition disposition)
{
return _session->set_control (control, val, disposition);
}
boost::shared_ptr<Stripable>
BasicUI::monitor_out () const
{

View file

@ -27,6 +27,7 @@
#include "ardour/types.h"
#include "control_protocol/visibility.h"
#include "temporal/timeline.h"
#include "pbd/controllable.h"
#include "pbd/signals.h"
#include "temporal/time.h"
@ -190,6 +191,16 @@ public:
const SessionConfiguration& config () const;
SessionConfiguration& config ();
/* Control-based methods */
void set_controls (boost::shared_ptr<ControlList>,
double val,
PBD::Controllable::GroupControlDisposition);
void set_control (boost::shared_ptr<AutomationControl>,
double val,
PBD::Controllable::GroupControlDisposition);
/* Monitor/Master Out */
boost::shared_ptr<Stripable> monitor_out () const;

View file

@ -23,7 +23,6 @@
#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"
@ -140,7 +139,7 @@ FaderPort::solo ()
return;
}
_session->set_control (_current_stripable->solo_control(), !_current_stripable->solo_control()->self_soloed(), PBD::Controllable::UseGroup);
set_control (_current_stripable->solo_control(), !_current_stripable->solo_control()->self_soloed(), PBD::Controllable::UseGroup);
}
void

View file

@ -349,7 +349,7 @@ FaderPort8::button_solo_clear ()
cl->push_back (ac);
}
if (!cl->empty()) {
_session->set_controls (cl, 1.0, PBD::Controllable::NoGroup);
set_controls (cl, 1.0, PBD::Controllable::NoGroup);
}
}
}
@ -373,7 +373,7 @@ FaderPort8::button_mute_clear ()
ac->start_touch (timepos_t (transport_sample()));
}
if (!cl->empty()) {
_session->set_controls (cl, 1.0, PBD::Controllable::NoGroup);
set_controls (cl, 1.0, PBD::Controllable::NoGroup);
}
}
#else

View file

@ -22,10 +22,11 @@
#include <algorithm>
#include "ardour/debug.h"
#include "ardour/gain_control.h"
#include "ardour/mute_control.h"
#include "ardour/session.h"
#include "ardour/solo_control.h"
#include "ardour/solo_isolate_control.h"
#include "ardour/stripable.h"
#include "launch_control_xl.h"
@ -932,7 +933,7 @@ LaunchControlXL::button_press_track_control(uint8_t n) {
boost::shared_ptr<AutomationControl> ac = get_ac_by_state(n);
if (ac) {
_session->set_control (ac, !ac->get_value(), PBD::Controllable::UseGroup);
set_control (ac, !ac->get_value(), PBD::Controllable::UseGroup);
}
}

View file

@ -161,7 +161,7 @@ MixLayout::MixLayout (Push2& p, Session & s, std::string const & name)
mode_button = p2.button_by_id (Push2::Upper1);
session.RouteAdded.connect (session_connections, invalidator(*this), boost::bind (&MixLayout::stripables_added, this), &p2);
p2.RouteAdded().connect (session_connections, invalidator(*this), boost::bind (&MixLayout::stripables_added, this), &p2);
session.vca_manager().VCAAdded.connect (session_connections, invalidator (*this), boost::bind (&MixLayout::stripables_added, this), &p2);
}
@ -405,7 +405,7 @@ MixLayout::button_solo ()
if (s) {
boost::shared_ptr<AutomationControl> ac = s->solo_control();
if (ac) {
session.set_control (ac, !ac->get_value(), PBD::Controllable::UseGroup);
p2.set_control (ac, !ac->get_value(), PBD::Controllable::UseGroup);
}
}
}

View file

@ -225,7 +225,7 @@ TrackMixLayout::button_lower (uint32_t n)
break;
case 1:
if (stripable->solo_control()) {
session.set_control (stripable->solo_control(), !stripable->solo_control()->self_soloed(), PBD::Controllable::UseGroup);
p2.set_control (stripable->solo_control(), !stripable->solo_control()->self_soloed(), PBD::Controllable::UseGroup);
}
break;
case 2:

View file

@ -21,11 +21,11 @@
#include "pbd/memento_command.h"
#include "ardour/debug.h"
#include "ardour/profile.h"
#include "ardour/session.h"
#include "ardour/route.h"
#include "ardour/location.h"
#include "ardour/profile.h"
#include "ardour/rc_configuration.h"
#include "ardour/route.h"
#include "ardour/session.h"
#include "us2400_control_protocol.h"
#include "surface.h"