Add BasicUI::config()

Towards removing the direct use of Session by surfaces.
This commit is contained in:
David Robillard 2021-06-15 19:59:20 -04:00
parent 850bd44702
commit 1f17d0834c
11 changed files with 36 additions and 18 deletions

View file

@ -800,3 +800,15 @@ BasicUI::make_port_name_non_relative (const std::string& name) const
{ {
return _session->engine ().make_port_name_non_relative (name); return _session->engine ().make_port_name_non_relative (name);
} }
const SessionConfiguration&
BasicUI::config () const
{
return _session->config;
}
SessionConfiguration&
BasicUI::config ()
{
return _session->config;
}

View file

@ -36,6 +36,7 @@
namespace ARDOUR { namespace ARDOUR {
class Session; class Session;
class SessionConfiguration;
class LIBCONTROLCP_API BasicUI { class LIBCONTROLCP_API BasicUI {
public: public:
@ -160,6 +161,11 @@ class LIBCONTROLCP_API BasicUI {
std::string make_port_name_non_relative (const std::string& name) const; std::string make_port_name_non_relative (const std::string& name) const;
/* Configuration */
const SessionConfiguration& config () const;
SessionConfiguration& config ();
protected: protected:
Session* _session; Session* _session;
}; };

View file

@ -706,8 +706,8 @@ void
FaderPort::parameter_changed (string what) FaderPort::parameter_changed (string what)
{ {
if (what == "punch-in" || what == "punch-out") { if (what == "punch-in" || what == "punch-out") {
bool in = _session->config.get_punch_in (); bool in = config ().get_punch_in ();
bool out = _session->config.get_punch_out (); bool out = config ().get_punch_out ();
if (in && out) { if (in && out) {
get_button (Punch).set_led_state (_output_port, true); get_button (Punch).set_led_state (_output_port, true);
blinkers.remove (Punch); blinkers.remove (Punch);
@ -725,7 +725,7 @@ FaderPort::connect_session_signals()
_session->RecordStateChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_recenable_state, this), this); _session->RecordStateChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_recenable_state, this), this);
_session->TransportStateChange.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_transport_state, this), this); _session->TransportStateChange.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::map_transport_state, this), this);
/* not session, but treat it similarly */ /* not session, but treat it similarly */
_session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::parameter_changed, this, _1), this); config ().ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort::parameter_changed, this, _1), this);
} }
bool bool

View file

@ -42,7 +42,7 @@ FaderPort8::connect_session_signals ()
PresentationInfo::Change.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_pi_property_changed, this, _1), this); PresentationInfo::Change.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_pi_property_changed, this, _1), this);
Config->ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_parameter_changed, this, _1), this); Config->ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_parameter_changed, this, _1), this);
_session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_parameter_changed, this, _1), this); config ().ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_parameter_changed, this, _1), this);
_session->TransportStateChange.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_transport_state_changed, this), this); _session->TransportStateChange.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_transport_state_changed, this), this);
_session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_loop_state_changed, this), this); _session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&FaderPort8::notify_loop_state_changed, this), this);

View file

@ -698,7 +698,7 @@ LaunchControlXL::connect_session_signals()
_session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_loop_state_changed, this), this); _session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_loop_state_changed, this), this);
// receive punch-in and punch-out // receive punch-in and punch-out
Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_parameter_changed, this, _1), this); Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_parameter_changed, this, _1), this);
_session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_parameter_changed, this, _1), this); config ().ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_parameter_changed, this, _1), this);
// receive rude solo changed // receive rude solo changed
//_session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_solo_active_changed, this, _1), this); //_session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&LaunchControlXL::notify_solo_active_changed, this, _1), this);

View file

@ -751,7 +751,7 @@ MackieControlProtocol::connect_session_signals()
_session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_loop_state_changed, this), this); _session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_loop_state_changed, this), this);
// receive punch-in and punch-out // receive punch-in and punch-out
Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this); Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this);
_session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this); config ().ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_parameter_changed, this, _1), this);
// receive rude solo changed // receive rude solo changed
_session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1), this); _session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&MackieControlProtocol::notify_solo_active_changed, this, _1), this);
@ -1250,9 +1250,9 @@ MackieControlProtocol::update_timecode_display()
void MackieControlProtocol::notify_parameter_changed (std::string const & p) void MackieControlProtocol::notify_parameter_changed (std::string const & p)
{ {
if (p == "punch-in") { if (p == "punch-in") {
update_global_button (Button::Drop, _session->config.get_punch_in() ? flashing : off); update_global_button (Button::Drop, config ().get_punch_in() ? flashing : off);
} else if (p == "punch-out") { } else if (p == "punch-out") {
update_global_button (Button::Replace, _session->config.get_punch_out() ? flashing : off); update_global_button (Button::Replace, config ().get_punch_out() ? flashing : off);
} else if (p == "clicking") { } else if (p == "clicking") {
update_global_button (Button::Click, Config->get_clicking()); update_global_button (Button::Click, Config->get_clicking());
} else if (p == "follow-edits") { } else if (p == "follow-edits") {
@ -1262,9 +1262,9 @@ void MackieControlProtocol::notify_parameter_changed (std::string const & p)
* this button (if there is one) won't reflect the setting. * this button (if there is one) won't reflect the setting.
*/ */
//update_global_button (Button::Enter, _session->config.get_follow_edits() ? on : off); //update_global_button (Button::Enter, config ().get_follow_edits() ? on : off);
} else if (p == "external-sync") { } else if (p == "external-sync") {
update_global_button (Button::Cancel, _session->config.get_external_sync() ? on : off); update_global_button (Button::Cancel, config ().get_external_sync() ? on : off);
} else { } else {
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("parameter changed: %1\n", p)); DEBUG_TRACE (DEBUG::MackieControl, string_compose ("parameter changed: %1\n", p));
} }

View file

@ -44,7 +44,7 @@ Maschine2::connect_signals ()
_session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_loop_state_changed, this), this); _session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_loop_state_changed, this), this);
_session->RecordStateChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_record_state_changed, this), this); _session->RecordStateChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_record_state_changed, this), this);
Config->ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_parameter_changed, this, _1), this); Config->ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_parameter_changed, this, _1), this);
_session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_parameter_changed, this, _1), this); config ().ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_parameter_changed, this, _1), this);
_session->DirtyChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_session_dirty_changed, this), this); _session->DirtyChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_session_dirty_changed, this), this);
_session->history().Changed.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_history_changed, this), this); _session->history().Changed.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Maschine2::notify_history_changed, this), this);

View file

@ -502,12 +502,12 @@ OSCGlobalObserver::solo_active (bool active)
void void
OSCGlobalObserver::extra_check () OSCGlobalObserver::extra_check ()
{ {
if (last_punchin != session->config.get_punch_in()) { if (last_punchin != _osc.config().get_punch_in()) {
last_punchin = session->config.get_punch_in(); last_punchin = _osc.config().get_punch_in();
_osc.float_message (X_("/toggle_punch_in"), last_punchin, addr); _osc.float_message (X_("/toggle_punch_in"), last_punchin, addr);
} }
if (last_punchout != session->config.get_punch_out()) { if (last_punchout != _osc.config().get_punch_out()) {
last_punchout = session->config.get_punch_out(); last_punchout = _osc.config().get_punch_out();
_osc.float_message (X_("/toggle_punch_out"), last_punchout, addr); _osc.float_message (X_("/toggle_punch_out"), last_punchout, addr);
} }
if (last_click != Config->get_clicking()) { if (last_click != Config->get_clicking()) {

View file

@ -872,7 +872,7 @@ Push2::connect_session_signals()
_session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_loop_state_changed, this), this); _session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_loop_state_changed, this), this);
// receive punch-in and punch-out // receive punch-in and punch-out
Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_parameter_changed, this, _1), this); Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_parameter_changed, this, _1), this);
_session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_parameter_changed, this, _1), this); config ().ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_parameter_changed, this, _1), this);
// receive rude solo changed // receive rude solo changed
_session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_solo_active_changed, this, _1), this); _session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&Push2::notify_solo_active_changed, this, _1), this);
} }

View file

@ -121,7 +121,7 @@ int TranzportControlProtocol::lights_show_normal()
/* Global settings */ /* Global settings */
lights_pending[LightLoop] = session->get_play_loop(); lights_pending[LightLoop] = session->get_play_loop();
lights_pending[LightPunch] = session->config.get_punch_in() || session->config.get_punch_out(); lights_pending[LightPunch] = config ().get_punch_in() || config().get_punch_out();
lights_pending[LightRecord] = session->get_record_enabled(); lights_pending[LightRecord] = session->get_record_enabled();
lights_pending[LightAnysolo] = session->soloing(); lights_pending[LightAnysolo] = session->soloing();

View file

@ -645,7 +645,7 @@ US2400Protocol::connect_session_signals()
_session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_loop_state_changed, this), this); _session->TransportLooped.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_loop_state_changed, this), this);
// receive punch-in and punch-out // receive punch-in and punch-out
Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_parameter_changed, this, _1), this); Config->ParameterChanged.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_parameter_changed, this, _1), this);
_session->config.ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_parameter_changed, this, _1), this); config ().ParameterChanged.connect (session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_parameter_changed, this, _1), this);
// receive rude solo changed // receive rude solo changed
_session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_solo_active_changed, this, _1), this); _session->SoloActive.connect(session_connections, MISSING_INVALIDATOR, boost::bind (&US2400Protocol::notify_solo_active_changed, this, _1), this);