diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-06 18:40:37 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2010-05-06 18:40:37 +0000 |
commit | f2ceb5c3404bb3e7f4ccc5bb3f2236f593775d73 (patch) | |
tree | b8cc08678ab9b4e189a5cd97ae16f425fe8ab0b4 /libs | |
parent | e1ed9467dc9f9ffec7549958b1bca27b753e8742 (diff) |
lots of odds and ends to do with solo isolate and its GUI
git-svn-id: svn://localhost/ardour2/branches/3.0@7072 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/session.h | 7 | ||||
-rw-r--r-- | libs/ardour/route.cc | 9 | ||||
-rw-r--r-- | libs/ardour/session.cc | 50 | ||||
-rw-r--r-- | libs/ardour/session_rtevents.cc | 18 | ||||
-rw-r--r-- | libs/ardour/session_state.cc | 1 |
5 files changed, 75 insertions, 10 deletions
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index b399745187..a321d1ffcc 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -583,6 +583,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi bool soloing() const { return _non_soloed_outs_muted; } bool listening() const { return _listen_cnt > 0; } + bool solo_isolated() const { return _solo_isolated_cnt > 0; } static const SessionEvent::RTeventCallback rt_cleanup; @@ -591,11 +592,12 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void set_mute (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); void set_listen (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); void set_record_enable (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); + void set_solo_isolated (boost::shared_ptr<RouteList>, bool, SessionEvent::RTeventCallback after = rt_cleanup, bool group_override = false); PBD::Signal1<void,bool> SoloActive; PBD::Signal0<void> SoloChanged; + PBD::Signal0<void> IsolatedChanged; - /* control/master out */ boost::shared_ptr<Route> monitor_out() const { return _monitor_out; } @@ -861,6 +863,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi float _meter_falloff; bool _non_soloed_outs_muted; uint32_t _listen_cnt; + uint32_t _solo_isolated_cnt; bool _writable; bool _was_seamless; @@ -1220,6 +1223,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void route_listen_changed (void *src, boost::weak_ptr<Route>); void route_mute_changed (void *src); void route_solo_changed (bool self_solo_change, void *src, boost::weak_ptr<Route>); + void route_solo_isolated_changed (void *src, boost::weak_ptr<Route>); void update_route_solo_state (boost::shared_ptr<RouteList> r = boost::shared_ptr<RouteList>()); void listen_position_changed (); @@ -1437,6 +1441,7 @@ class Session : public PBD::StatefulDestructible, public PBD::ScopedConnectionLi void rt_set_just_one_solo (boost::shared_ptr<RouteList>, bool yn, bool /* ignored*/ ); void rt_set_mute (boost::shared_ptr<RouteList>, bool yn, bool group_override); void rt_set_listen (boost::shared_ptr<RouteList>, bool yn, bool group_override); + void rt_set_solo_isolated (boost::shared_ptr<RouteList>, bool yn, bool group_override); void rt_set_record_enable (boost::shared_ptr<RouteList>, bool yn, bool group_override); /** temporary list of Diskstreams used only during load of 2.X sessions */ diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc index 48eeae7774..e5a4b01fd1 100644 --- a/libs/ardour/route.cc +++ b/libs/ardour/route.cc @@ -716,22 +716,27 @@ Route::set_solo_isolated (bool yn, void *src) /* XXX should we back-propagate as well? (April 2010: myself and chris goddard think not) */ + bool changed = false; + if (yn) { if (_solo_isolated == 0) { _mute_master->set_solo_ignore (true); + changed = true; } _solo_isolated++; - solo_isolated_changed (src); } else { if (_solo_isolated > 0) { _solo_isolated--; if (_solo_isolated == 0) { _mute_master->set_solo_ignore (false); + changed = true; } - solo_isolated_changed (src); } } + if (changed) { + solo_isolated_changed (src); + } } bool diff --git a/libs/ardour/session.cc b/libs/ardour/session.cc index 0b796a32bf..3e22150762 100644 --- a/libs/ardour/session.cc +++ b/libs/ardour/session.cc @@ -1993,6 +1993,7 @@ Session::add_routes (RouteList& new_routes, bool save) r->listen_changed.connect_same_thread (*this, boost::bind (&Session::route_listen_changed, this, _1, wpr)); r->solo_changed.connect_same_thread (*this, boost::bind (&Session::route_solo_changed, this, _1, _2, wpr)); + r->solo_isolated_changed.connect_same_thread (*this, boost::bind (&Session::route_solo_isolated_changed, this, _1, wpr)); r->mute_changed.connect_same_thread (*this, boost::bind (&Session::route_mute_changed, this, _1)); r->output()->changed.connect_same_thread (*this, boost::bind (&Session::set_worst_io_latencies_x, this, _1, _2)); r->processors_changed.connect_same_thread (*this, boost::bind (&Session::route_processors_changed, this, _1)); @@ -2161,14 +2162,13 @@ Session::remove_route (shared_ptr<Route> route) _monitor_out.reset (); } - update_route_solo_state (); - /* writer goes out of scope, forces route list update */ } - + + update_route_solo_state (); find_current_end (); - // We need to disconnect the routes inputs and outputs + // We need to disconnect the route's inputs and outputs route->input()->disconnect (0); route->output()->disconnect (0); @@ -2244,7 +2244,36 @@ Session::route_listen_changed (void* /*src*/, boost::weak_ptr<Route> wpr) _listen_cnt--; } } +void +Session::route_solo_isolated_changed (void* /*src*/, boost::weak_ptr<Route> wpr) +{ + boost::shared_ptr<Route> route = wpr.lock (); + if (!route) { + /* should not happen */ + error << string_compose (_("programming error: %1"), X_("invalid route weak ptr passed to route_solo_changed")) << endmsg; + return; + } + + bool send_changed = false; + + if (route->solo_isolated()) { + if (_solo_isolated_cnt == 0) { + send_changed = true; + } + _solo_isolated_cnt++; + } else if (_solo_isolated_cnt > 0) { + _solo_isolated_cnt--; + if (_solo_isolated_cnt == 0) { + send_changed = true; + } + } + + if (send_changed) { + IsolatedChanged (); /* EMIT SIGNAL */ + } +} + void Session::route_solo_changed (bool self_solo_change, void* /*src*/, boost::weak_ptr<Route> wpr) { @@ -2340,6 +2369,7 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) bool something_soloed = false; uint32_t listeners = 0; + uint32_t isolated = 0; if (!r) { r = routes.reader(); @@ -2348,7 +2378,6 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) for (RouteList::iterator i = r->begin(); i != r->end(); ++i) { if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_hidden() && (*i)->self_soloed()) { something_soloed = true; - break; } if (!(*i)->is_hidden() && (*i)->listening()) { @@ -2358,6 +2387,10 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) (*i)->set_listen (false, this); } } + + if ((*i)->solo_isolated()) { + isolated++; + } } if (something_soloed != _non_soloed_outs_muted) { @@ -2365,8 +2398,11 @@ Session::update_route_solo_state (boost::shared_ptr<RouteList> r) SoloActive (_non_soloed_outs_muted); /* EMIT SIGNAL */ } - if (listeners) { - _listen_cnt = listeners; + _listen_cnt = listeners; + + if (isolated != _solo_isolated_cnt) { + _solo_isolated_cnt = isolated; + IsolatedChanged (); /* EMIT SIGNAL */ } } diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc index 2befe47c16..921a6348eb 100644 --- a/libs/ardour/session_rtevents.cc +++ b/libs/ardour/session_rtevents.cc @@ -130,6 +130,24 @@ Session::rt_set_mute (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_ove } void +Session::set_solo_isolated (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) +{ + queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_solo_isolated)); +} + +void +Session::rt_set_solo_isolated (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_override*/) +{ + for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { + if (!(*i)->is_master() && !(*i)->is_monitor() && !(*i)->is_hidden()) { + (*i)->set_solo_isolated (yn, this); + } + } + + set_dirty(); +} + +void Session::set_record_enable (boost::shared_ptr<RouteList> rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) { if (!writable()) { diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc index ae2eda81d4..a0e61d547a 100644 --- a/libs/ardour/session_state.cc +++ b/libs/ardour/session_state.cc @@ -170,6 +170,7 @@ Session::first_stage_init (string fullpath, string snapshot_name) _non_soloed_outs_muted = false; _listen_cnt = 0; + _solo_isolated_cnt = 0; g_atomic_int_set (&processing_prohibited, 0); _transport_speed = 0; _last_transport_speed = 0; |