summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/route.h7
-rw-r--r--libs/ardour/route.cc46
-rw-r--r--libs/ardour/session_rtevents.cc6
-rw-r--r--libs/evoral/evoral/Control.hpp2
4 files changed, 42 insertions, 19 deletions
diff --git a/libs/ardour/ardour/route.h b/libs/ardour/ardour/route.h
index 6dbdda496c..5d52fc0c52 100644
--- a/libs/ardour/ardour/route.h
+++ b/libs/ardour/ardour/route.h
@@ -394,15 +394,18 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
void set_value (double);
double get_value () const;
+ /* Pretend to change value, but do not affect actual route mute. */
+ void set_superficial_value(bool muted);
+
private:
boost::weak_ptr<Route> _route;
};
- boost::shared_ptr<AutomationControl> solo_control() const {
+ boost::shared_ptr<SoloControllable> solo_control() const {
return _solo_control;
}
- boost::shared_ptr<AutomationControl> mute_control() const {
+ boost::shared_ptr<MuteControllable> mute_control() const {
return _mute_control;
}
diff --git a/libs/ardour/route.cc b/libs/ardour/route.cc
index a93a6a1bf8..b9acae45eb 100644
--- a/libs/ardour/route.cc
+++ b/libs/ardour/route.cc
@@ -3409,7 +3409,7 @@ Route::SoloControllable::SoloControllable (std::string name, boost::shared_ptr<R
void
Route::SoloControllable::set_value (double val)
{
- bool bval = ((val >= 0.5f) ? true: false);
+ const bool bval = ((val >= 0.5) ? true : false);
boost::shared_ptr<RouteList> rl (new RouteList);
@@ -3456,37 +3456,51 @@ Route::MuteControllable::MuteControllable (std::string name, boost::shared_ptr<R
}
void
-Route::MuteControllable::set_value (double val)
+Route::MuteControllable::set_superficial_value(bool muted)
{
- bool bval = ((val >= 0.5f) ? true: false);
+ /* Note we can not use AutomationControl::set_value here since it will emit
+ Changed(), but the value will not be correct to the observer. */
+
+ bool to_list = _list && ((AutomationList*)_list.get())->automation_write();
+
+ Control::set_double (muted, _session.transport_frame(), to_list);
+}
- // boost::shared_ptr<RouteList> rl (new RouteList);
+void
+Route::MuteControllable::set_value (double val)
+{
+ const bool bval = ((val >= 0.5) ? true : false);
boost::shared_ptr<Route> r = _route.lock ();
if (!r) {
return;
}
- /* I don't know why this apparently "should" be done via the RT event
- system, but doing so causes a ton of annoying errors... */
- // rl->push_back (r);
- // _session.set_mute (rl, bval);
-
- /* ... but this seems to work. */
- r->set_mute (bval, this);
+ if (_list && ((AutomationList*)_list.get())->automation_playback()) {
+ // Playing back automation, set route mute directly
+ r->set_mute (bval, this);
+ } else {
+ // Set from user, queue mute event
+ boost::shared_ptr<RouteList> rl (new RouteList);
+ rl->push_back (r);
+ _session.set_mute (rl, bval, Session::rt_cleanup);
+ }
- AutomationControl::set_value(bval);
+ // Set superficial/automation value to drive controller (and possibly record)
+ set_superficial_value(bval);
}
double
Route::MuteControllable::get_value () const
{
- boost::shared_ptr<Route> r = _route.lock ();
- if (!r) {
- return 0;
+ if (_list && ((AutomationList*)_list.get())->automation_playback()) {
+ // Playing back automation, get the value from the list
+ return AutomationControl::get_value();
}
- return r->muted() ? 1.0f : 0.0f;
+ // Not playing back automation, get the actual route mute value
+ boost::shared_ptr<Route> r = _route.lock ();
+ return (r && r->muted()) ? 1.0 : 0.0;
}
void
diff --git a/libs/ardour/session_rtevents.cc b/libs/ardour/session_rtevents.cc
index 6328607eec..4bd7c2da9a 100644
--- a/libs/ardour/session_rtevents.cc
+++ b/libs/ardour/session_rtevents.cc
@@ -143,6 +143,12 @@ Session::rt_set_listen (boost::shared_ptr<RouteList> rl, bool yn, bool /*group_o
void
Session::set_mute (boost::shared_ptr<RouteList> 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<Route::MuteControllable> mc = (*i)->mute_control();
+ mc->set_superficial_value(yn);
+ }
+
queue_event (get_rt_event (rl, yn, after, group_override, &Session::rt_set_mute));
}
diff --git a/libs/evoral/evoral/Control.hpp b/libs/evoral/evoral/Control.hpp
index d91c89bb74..490abf00b6 100644
--- a/libs/evoral/evoral/Control.hpp
+++ b/libs/evoral/evoral/Control.hpp
@@ -50,7 +50,7 @@ public:
virtual ~Control() {}
- virtual void set_double (double val, double frame=0, bool to_list=false);
+ virtual void set_double (double val, double frame=0, bool to_list=false);
virtual double get_double (bool from_list=false, double frame=0) const;
/** Get the latest user-set value