summaryrefslogtreecommitdiff
path: root/libs/evoral
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2010-09-24 14:05:20 +0000
committerCarl Hetherington <carl@carlh.net>2010-09-24 14:05:20 +0000
commit42a23312a0621b762c6a0d138915ba02065db241 (patch)
tree3361fd442a1ae9fe768e3ce244a632700412b2d6 /libs/evoral
parentca00c3bcc34fe563635eeb6fe7322f50ced0c8f6 (diff)
Slightly hacky but functional fix for large quantities of MIDI output when interpolating sharp changes in controller value. Fixes #3476.
git-svn-id: svn://localhost/ardour2/branches/3.0@7840 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/evoral')
-rw-r--r--libs/evoral/src/Sequence.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/libs/evoral/src/Sequence.cpp b/libs/evoral/src/Sequence.cpp
index 36758c3274..b6a7dceca1 100644
--- a/libs/evoral/src/Sequence.cpp
+++ b/libs/evoral/src/Sequence.cpp
@@ -39,6 +39,16 @@
using namespace std;
using namespace PBD;
+/** Minimum time between MIDI outputs from a single controller,
+ expressed in beats. This is to limit the rate at which MIDI messages
+ are generated, particularly for quickly-changing controllers which
+ are being interpolated.
+
+ XXX: This is a hack. The time should probably be expressed in
+ seconds rather than beats, and should be configurable etc. etc.
+*/
+static double const time_between_controller_outputs = 1.0 / 256;
+
namespace Evoral {
// Read iterator (const_iterator)
@@ -253,9 +263,9 @@ Sequence<Time>::const_iterator::operator++()
case CONTROL:
// Increment current controller iterator
if (_force_discrete) {
- ret = _control_iter->list->rt_safe_earliest_event_discrete_unlocked (_control_iter->x, x, y, false);
+ ret = _control_iter->list->rt_safe_earliest_event_discrete_unlocked (_control_iter->x + time_between_controller_outputs, x, y, false);
} else {
- ret = _control_iter->list->rt_safe_earliest_event_unlocked (_control_iter->x, x, y, false);
+ ret = _control_iter->list->rt_safe_earliest_event_unlocked (_control_iter->x + time_between_controller_outputs, x, y, false);
}
assert(!ret || x > _control_iter->x);
if (ret) {