summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2015-10-07 10:42:28 +0200
committerRobin Gareus <robin@gareus.org>2015-10-07 14:21:29 +0200
commit96b45d49099069981109d8f3f292ad1024649f61 (patch)
treef948f8e9e346d8ac2a581642ddbce032ba5a740b
parent5fd4ee3ef1c422b3907e2a531c10d5c4d7d60674 (diff)
only subdivide plugin-cycle when automation is playing
PluginInsert::automation_run() subdivides plugin-run on every control-port automation event (without splitting the process cycle). libevoral has no automation-control context, hence this function must be implemented by Automatable.
-rw-r--r--libs/ardour/ardour/automatable.h1
-rw-r--r--libs/ardour/automatable.cc39
-rw-r--r--libs/evoral/evoral/ControlSet.hpp2
-rw-r--r--libs/evoral/src/ControlSet.cpp32
-rw-r--r--libs/evoral/test/SequenceTest.hpp2
5 files changed, 43 insertions, 33 deletions
diff --git a/libs/ardour/ardour/automatable.h b/libs/ardour/ardour/automatable.h
index ddf9eee8bb..c9e14cfae5 100644
--- a/libs/ardour/ardour/automatable.h
+++ b/libs/ardour/ardour/automatable.h
@@ -57,6 +57,7 @@ public:
automation_control (const Evoral::Parameter& id) const;
virtual void add_control(boost::shared_ptr<Evoral::Control>);
+ virtual bool find_next_event(double start, double end, Evoral::ControlEvent& ev, bool only_active = true) const;
void clear_controls ();
virtual void transport_located (framepos_t now);
diff --git a/libs/ardour/automatable.cc b/libs/ardour/automatable.cc
index e0c21a6f6f..0b316890bc 100644
--- a/libs/ardour/automatable.cc
+++ b/libs/ardour/automatable.cc
@@ -501,3 +501,42 @@ Automatable::value_as_string (boost::shared_ptr<AutomationControl> ac) const
{
return ARDOUR::value_as_string(ac->desc(), ac->get_value());
}
+
+bool
+Automatable::find_next_event (double now, double end, Evoral::ControlEvent& next_event, bool only_active) const
+{
+ Controls::const_iterator li;
+
+ next_event.when = std::numeric_limits<double>::max();
+
+ for (li = _controls.begin(); li != _controls.end(); ++li) {
+ boost::shared_ptr<AutomationControl> c
+ = boost::dynamic_pointer_cast<AutomationControl>(li->second);
+
+ if (only_active && (!c || !c->automation_playback())) {
+ continue;
+ }
+
+ Evoral::ControlList::const_iterator i;
+ boost::shared_ptr<const Evoral::ControlList> alist (li->second->list());
+ Evoral::ControlEvent cp (now, 0.0f);
+ if (!alist) {
+ continue;
+ }
+
+ for (i = lower_bound (alist->begin(), alist->end(), &cp, Evoral::ControlList::time_comparator);
+ i != alist->end() && (*i)->when < end; ++i) {
+ if ((*i)->when > now) {
+ break;
+ }
+ }
+
+ if (i != alist->end() && (*i)->when < end) {
+ if ((*i)->when < next_event.when) {
+ next_event.when = (*i)->when;
+ }
+ }
+ }
+
+ return next_event.when != std::numeric_limits<double>::max();
+}
diff --git a/libs/evoral/evoral/ControlSet.hpp b/libs/evoral/evoral/ControlSet.hpp
index b7d50d7d2e..f1c2d96f49 100644
--- a/libs/evoral/evoral/ControlSet.hpp
+++ b/libs/evoral/evoral/ControlSet.hpp
@@ -60,7 +60,7 @@ public:
virtual void add_control(boost::shared_ptr<Control>);
- bool find_next_event(double start, double end, ControlEvent& ev) const;
+ virtual bool find_next_event(double start, double end, ControlEvent& ev, bool only_active = true) const = 0;
virtual bool controls_empty() const { return _controls.size() == 0; }
virtual void clear_controls();
diff --git a/libs/evoral/src/ControlSet.cpp b/libs/evoral/src/ControlSet.cpp
index f24c410d73..cc8d7c60a7 100644
--- a/libs/evoral/src/ControlSet.cpp
+++ b/libs/evoral/src/ControlSet.cpp
@@ -87,38 +87,6 @@ ControlSet::control (const Parameter& parameter, bool create_if_missing)
}
}
-bool
-ControlSet::find_next_event (double now, double end, ControlEvent& next_event) const
-{
- Controls::const_iterator li;
-
- next_event.when = std::numeric_limits<double>::max();
-
- for (li = _controls.begin(); li != _controls.end(); ++li) {
- ControlList::const_iterator i;
- boost::shared_ptr<const ControlList> alist (li->second->list());
- ControlEvent cp (now, 0.0f);
- if (!alist) {
- continue;
- }
-
- for (i = lower_bound (alist->begin(), alist->end(), &cp, ControlList::time_comparator);
- i != alist->end() && (*i)->when < end; ++i) {
- if ((*i)->when > now) {
- break;
- }
- }
-
- if (i != alist->end() && (*i)->when < end) {
- if ((*i)->when < next_event.when) {
- next_event.when = (*i)->when;
- }
- }
- }
-
- return next_event.when != std::numeric_limits<double>::max();
-}
-
void
ControlSet::clear_controls ()
{
diff --git a/libs/evoral/test/SequenceTest.hpp b/libs/evoral/test/SequenceTest.hpp
index da1991efc8..3207541571 100644
--- a/libs/evoral/test/SequenceTest.hpp
+++ b/libs/evoral/test/SequenceTest.hpp
@@ -51,6 +51,8 @@ class MySequence : public Sequence<Time> {
public:
MySequence(DummyTypeMap&map) : Sequence<Time>(map) {}
+ virtual bool find_next_event(double start, double end, ControlEvent& ev, bool only_active) const { return false; }
+
boost::shared_ptr<Control> control_factory(const Parameter& param) {
const Evoral::ParameterDescriptor desc;
boost::shared_ptr<ControlList> list(new ControlList(param, desc));