X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fardour%2Fsession_rtevents.cc;h=f1f99e369373e3dda0e9380482cae287f6001d55;hb=db3223478c914f5b9ef97343ae2f262d3e99f74b;hp=189385e2ee8281fb55c0cd637c61a7b772b6e8f7;hpb=96720089cfba20e023937e0d869a4c03fbf01ee2;p=ardour.git diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc index 189385e2ee..f1f99e3693 100644 --- a/libs/ardour/session_rtevents.cc +++ b/libs/ardour/session_rtevents.cc @@ -21,9 +21,11 @@ #include "pbd/error.h" #include "pbd/compose.h" -#include "ardour/session.h" +#include "ardour/monitor_control.h" #include "ardour/route.h" +#include "ardour/session.h" #include "ardour/track.h" +#include "ardour/vca_manager.h" #include "i18n.h" @@ -33,210 +35,61 @@ using namespace ARDOUR; using namespace Glib; void -Session::set_monitoring (boost::shared_ptr rl, MonitorChoice mc, SessionEvent::RTeventCallback after, bool group_override) -{ - queue_event (get_rt_event (rl, mc, after, group_override, &Session::rt_set_monitoring)); -} - -void -Session::rt_set_monitoring (boost::shared_ptr rl, MonitorChoice mc, bool /* group_override */) -{ - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - if (!(*i)->is_auditioner()) { - boost::shared_ptr t = boost::dynamic_pointer_cast (*i); - if (t) { - t->set_monitoring (mc); - } - } - } - - set_dirty(); -} - -void -Session::set_solo (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) -{ - queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_solo)); -} - -void -Session::rt_set_solo (boost::shared_ptr rl, bool yn, bool /* group_override */) -{ - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - if (!(*i)->is_auditioner()) { - (*i)->set_solo (yn, this); - } - } - - set_dirty(); - /* XXX boost::shared_ptr goes out of scope here and is likley free()ed in RT context - * because boost's shared_ptr does reference counting and free/delete in the dtor. - * (this also applies to other rt_ methods here) - */ -} - -void -Session::set_just_one_solo (boost::shared_ptr r, bool yn, SessionEvent::RTeventCallback after) +Session::set_controls (boost::shared_ptr cl, double val, Controllable::GroupControlDisposition gcd) { - /* its a bit silly to have to do this, but it keeps the API for this public method sane (we're - only going to solo one route) and keeps our ability to use get_rt_event() for the internal - private method. - */ - - boost::shared_ptr rl (new RouteList); - rl->push_back (r); - - queue_event (get_rt_event (rl, yn, after, false, &Session::rt_set_just_one_solo)); -} - -void -Session::rt_set_just_one_solo (boost::shared_ptr just_one, bool yn, bool /*ignored*/) -{ - boost::shared_ptr rl = routes.reader (); - boost::shared_ptr r = just_one->front(); - - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - if (!(*i)->is_auditioner() && r != *i) { - (*i)->set_solo (!yn, (*i)->route_group()); - } - } - - r->set_solo (yn, r->route_group()); - - set_dirty(); -} - -void -Session::set_listen (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) -{ - queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_listen)); -} - -void -Session::rt_set_listen (boost::shared_ptr rl, bool yn, bool /*group_override*/ ) -{ - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - if (!(*i)->is_auditioner()) { - (*i)->set_listen (yn, this); - } + if (cl->empty()) { + return; } - set_dirty(); -} + std::cerr << "Session::set_controls called on " << cl->size() << " controls, group = " << enum_2_string (gcd) << std::endl; -void -Session::set_mute (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) -{ - /* Set superficial value of mute controls for automation. */ - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - boost::shared_ptr mc = (*i)->mute_control(); - mc->set_superficial_value(yn); + for (ControlList::iterator ci = cl->begin(); ci != cl->end(); ++ci) { + /* as of july 2017 this is a no-op for everything except record enable */ + (*ci)->do_pre_realtime_queue_stuff (val); } - queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_mute)); + queue_event (get_rt_event (cl, val, gcd)); } void -Session::rt_set_mute (boost::shared_ptr rl, bool yn, bool /*group_override*/) +Session::set_control (boost::shared_ptr ac, double val, Controllable::GroupControlDisposition gcd) { - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - if (!(*i)->is_monitor() && !(*i)->is_auditioner()) { - (*i)->set_mute (yn, this); - } + if (!ac) { + return; } - set_dirty(); + boost::shared_ptr cl (new ControlList); + cl->push_back (ac); + set_controls (cl, val, gcd); } void -Session::set_solo_isolated (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) +Session::rt_set_controls (boost::shared_ptr cl, double val, Controllable::GroupControlDisposition gcd) { - queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_solo_isolated)); -} - -void -Session::rt_set_solo_isolated (boost::shared_ptr 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_auditioner()) { - (*i)->set_solo_isolated (yn, this); - } + for (ControlList::iterator c = cl->begin(); c != cl->end(); ++c) { + (*c)->set_value (val, gcd); } - - set_dirty(); } void -Session::set_record_enabled (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) +Session::clear_all_solo_state (boost::shared_ptr rl) { - if (!writable()) { - return; - } - - /* do the non-RT part of rec-enabling first - the RT part will be done - * on the next process cycle. This does mean that theoretically we are - * doing things provisionally on the assumption that the rec-enable - * change will work, but this had better be a solid assumption for - * other reasons. - */ - - for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - if ((*i)->is_auditioner() || (*i)->record_safe ()) { - continue; - } - - boost::shared_ptr t; - - if ((t = boost::dynamic_pointer_cast(*i)) != 0) { - t->prep_record_enabled (yn, (group_override ? (void*) t->route_group() : (void *) this)); - } - } - - queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_record_enabled)); + queue_event (get_rt_event (rl, false, rt_cleanup, Controllable::NoGroup, &Session::rt_clear_all_solo_state)); } void -Session::rt_set_record_enabled (boost::shared_ptr rl, bool yn, bool group_override) +Session::rt_clear_all_solo_state (boost::shared_ptr rl, bool /* yn */, Controllable::GroupControlDisposition /* group_override */) { for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { - if ((*i)->is_auditioner() || (*i)->record_safe ()) { + if ((*i)->is_auditioner()) { continue; } - - boost::shared_ptr t; - - if ((t = boost::dynamic_pointer_cast(*i)) != 0) { - t->set_record_enabled (yn, (group_override ? (void*) t->route_group() : (void *) this)); - } + (*i)->clear_all_solo_state(); } - set_dirty (); -} - + _vca_manager->clear_all_solo_state (); -void -Session::set_record_safe (boost::shared_ptr rl, bool yn, SessionEvent::RTeventCallback after, bool group_override) -{ - set_record_enabled (rl, false, after, group_override); - queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_record_safe)); -} - -void -Session::rt_set_record_safe (boost::shared_ptr rl, bool yn, bool group_override) -{ - for (RouteList::iterator i = rl->begin (); i != rl->end (); ++i) { - if ((*i)->is_auditioner ()) { // REQUIRES REVIEW Can audiotioner be in Record Safe mode? - continue; - } - - boost::shared_ptr t; - - if ((t = boost::dynamic_pointer_cast(*i)) != 0) { - t->set_record_safe (yn, (group_override ? (void*) t->route_group () : (void *) this)); - } - } - - set_dirty (); + set_dirty(); } void