[SCM] ardour3/master: Fix MIDI data loss when editing (Closes: #772118)
adiknoth-guest at users.alioth.debian.org
adiknoth-guest at users.alioth.debian.org
Fri Dec 5 12:29:05 UTC 2014
The following commit has been merged in the master branch:
commit 23ad45ff553bc7d59c83c644dc9b06c14ee3605a
Author: Adrian Knoth <adi at drcomp.erfurt.thur.de>
Date: Thu Dec 4 18:44:27 2014 +0100
Fix MIDI data loss when editing (Closes: #772118)
diff --git a/debian/patches/midi-data-loss.patch b/debian/patches/midi-data-loss.patch
new file mode 100644
index 0000000..9f7e8b6
--- /dev/null
+++ b/debian/patches/midi-data-loss.patch
@@ -0,0 +1,62 @@
+From: David Robillard <d at drobilla.net>
+Description: Fix MIDI data loss when editing
+Forwarded: not-needed
+Last-Update: 2014-12-04
+Bug-Vendor: http://tracker.ardour.org/view.php?id=5669
+Applied-Upstream: 3.5.404; https://github.com/Ardour/ardour/commit/94954f852ead97bcda7afa548d543222733228ef
+--- ardour3.orig/libs/ardour/smf_source.cc
++++ ardour3/libs/ardour/smf_source.cc
+@@ -393,10 +393,22 @@ SMFSource::append_event_unlocked_beats (
+ name().c_str(), ev.id(), ev.time(), ev.size());
+ for (size_t i = 0; i < ev.size(); ++i) printf("%X ", ev.buffer()[i]); printf("\n");*/
+
+- if (ev.time() < _last_ev_time_beats) {
+- warning << string_compose(_("Skipping event with unordered time %1"), ev.time())
+- << endmsg;
+- return;
++ double time = ev.time();
++ if (time < _last_ev_time_beats) {
++ const double difference = _last_ev_time_beats - time;
++ if (difference / (double)ppqn() < 1.0) {
++ /* Close enough. This problem occurs because Sequence is not
++ actually ordered due to fuzzy time comparison. I'm pretty sure
++ this is inherently a bad idea which causes problems all over the
++ place, but tolerate it here for now anyway. */
++ time = _last_ev_time_beats;
++ } else {
++ /* Out of order by more than a tick. */
++ warning << string_compose(_("Skipping event with unordered beat time %1 < %2 (off by %3 beats, %4 ticks)"),
++ ev.time(), _last_ev_time_beats, difference, difference / (double)ppqn())
++ << endmsg;
++ return;
++ }
+ }
+
+ Evoral::event_id_t event_id;
+@@ -411,13 +423,13 @@ SMFSource::append_event_unlocked_beats (
+ _model->append (ev, event_id);
+ }
+
+- _length_beats = max(_length_beats, ev.time());
++ _length_beats = max(_length_beats, time);
+
+- const double delta_time_beats = ev.time() - _last_ev_time_beats;
++ const double delta_time_beats = time - _last_ev_time_beats;
+ const uint32_t delta_time_ticks = (uint32_t)lrint(delta_time_beats * (double)ppqn());
+
+ Evoral::SMF::append_event_delta(delta_time_ticks, ev.size(), ev.buffer(), event_id);
+- _last_ev_time_beats = ev.time();
++ _last_ev_time_beats = time;
+ _flags = Source::Flag (_flags & ~Empty);
+ }
+
+@@ -434,7 +446,8 @@ SMFSource::append_event_unlocked_frames
+ // for (size_t i=0; i < ev.size(); ++i) printf("%X ", ev.buffer()[i]); printf("\n");
+
+ if (ev.time() < _last_ev_time_frames) {
+- warning << string_compose(_("Skipping event with unordered time %1"), ev.time())
++ warning << string_compose(_("Skipping event with unordered frame time %1 < %2"),
++ ev.time(), _last_ev_time_frames)
+ << endmsg;
+ return;
+ }
--
ardour3 packaging
More information about the pkg-multimedia-commits
mailing list