summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-03-01 16:45:42 +0100
committerRobin Gareus <robin@gareus.org>2019-03-01 16:45:42 +0100
commit1854a72b804fe011f8fd019a6003e024c0c95bdb (patch)
treef1b2dd9f93c3fd48c9bbd35d68e966ee1f4a19cb /libs/ardour
parent6064c75fd5b17a1a8483c040964b81885e38ac8d (diff)
Revert Monitor-Section to be per session
This partially reverts 639dff3a7c7. When loading a session, the monitor-bus that was saved with the session is used. This changes semantics of the monitor-section/config. Config::set_use_monitor_bus(bool) is used to initiate a change! Notification about the change is sent asynchronously by Session::MonitorBusAddedOrRemoved It is no longer possible to directly call add/remove_monitor_section() and leave the session + config in an inconsistent state.
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/session.h6
-rw-r--r--libs/ardour/luabindings.cc2
-rw-r--r--libs/ardour/session.cc5
-rw-r--r--libs/ardour/session_state.cc32
4 files changed, 34 insertions, 11 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 539b6595c2..560ccbf2c4 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -873,15 +873,14 @@ public:
PBD::Signal0<void> MuteChanged;
PBD::Signal0<void> IsolatedChanged;
PBD::Signal0<void> MonitorChanged;
+ PBD::Signal0<void> MonitorBusAddedOrRemoved;
PBD::Signal0<void> session_routes_reconnected;
/* monitor/master out */
int add_master_bus (ChanCount const&);
- void add_monitor_section ();
void reset_monitor_section ();
- void remove_monitor_section ();
bool monitor_active() const { return (_monitor_out && _monitor_out->monitor_control () && _monitor_out->monitor_control ()->monitor_active()); }
boost::shared_ptr<Route> monitor_out() const { return _monitor_out; }
@@ -1276,6 +1275,9 @@ private:
std::string _missing_file_replacement;
+ void add_monitor_section ();
+ void remove_monitor_section ();
+
void initialize_latencies ();
void update_latency (bool playback);
bool update_route_latency (bool reverse, bool apply_to_delayline);
diff --git a/libs/ardour/luabindings.cc b/libs/ardour/luabindings.cc
index 4191a44d7a..dcb83ebe44 100644
--- a/libs/ardour/luabindings.cc
+++ b/libs/ardour/luabindings.cc
@@ -2240,8 +2240,6 @@ LuaBindings::common (lua_State* L)
.addFunction ("new_midi_route", &Session::new_midi_route)
.addFunction ("add_master_bus", &Session::add_master_bus)
- .addFunction ("add_monitor_section", &Session::add_monitor_section)
- .addFunction ("remove_monitor_section", &Session::remove_monitor_section)
.addFunction ("get_routes", &Session::get_routes)
.addFunction ("get_tracks", &Session::get_tracks)
diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc
index dc55a2daeb..52c4e580ba 100644
--- a/libs/ardour/session.cc
+++ b/libs/ardour/session.cc
@@ -1213,7 +1213,7 @@ Session::remove_monitor_section ()
auditioner->connect ();
}
- Config->ParameterChanged ("use-monitor-bus");
+ MonitorBusAddedOrRemoved (); /* EMIT SIGNAL */
}
void
@@ -1369,7 +1369,8 @@ Session::add_monitor_section ()
if (auditioner) {
auditioner->connect ();
}
- Config->ParameterChanged ("use-monitor-bus");
+
+ MonitorBusAddedOrRemoved (); /* EMIT SIGNAL */
}
void
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index e23df492b1..b7c4faf5a4 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -4135,11 +4135,33 @@ Session::config_changed (std::string p, bool ours)
} else if (p == "auto-return-target-list") {
follow_playhead_priority ();
} else if (p == "use-monitor-bus") {
- bool yn = Config->get_use_monitor_bus();
- if (yn && !_monitor_out) {
- add_monitor_section ();
- } else if (!yn && _monitor_out) {
- remove_monitor_section ();
+ /* NB. This is always called when constructing a session,
+ * after restoring session state (if any),
+ * via post_engine_init() -> Config->map_parameters()
+ */
+ bool want_ms = Config->get_use_monitor_bus();
+ bool have_ms = _monitor_out ? true : false;
+ if (loading ()) {
+ /* When loading an existing session, the config "use-monitor-bus"
+ * is ignored. Instead the sesion-state (xml) will have added the
+ * "monitor-route" and restored its state (and connections)
+ * if the session has a monitor-section.
+ * Update the config to reflect this.
+ */
+ if (want_ms != have_ms) {
+ Config->set_use_monitor_bus (have_ms);
+ }
+ MonitorBusAddedOrRemoved (); /* EMIT SIGNAL */
+ } else {
+ /* Otherwise, Config::set_use_monitor_bus() does
+ * control the the presence of the monitor-section
+ * (new sessions, user initiated change)
+ */
+ if (want_ms && !have_ms) {
+ add_monitor_section ();
+ } else if (!want_ms && have_ms) {
+ remove_monitor_section ();
+ }
}
}