From 779a04b0ce12b9ccada4ca923046f0138487a723 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 7 Dec 2020 19:15:34 -0700 Subject: [PATCH] Evoral: alter ControlList::paste() to internally change time domain of pasted events --- libs/evoral/ControlList.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/evoral/ControlList.cc b/libs/evoral/ControlList.cc index 0cc9a49086..ca5d9e637d 100644 --- a/libs/evoral/ControlList.cc +++ b/libs/evoral/ControlList.cc @@ -1954,7 +1954,20 @@ ControlList::paste (const ControlList& alist, timepos_t const & time) /* catch possible rounding errors */ value = std::min ((double)_desc.upper, std::max ((double)_desc.lower, value)); } - _events.insert (where, new ControlEvent((*i)->when + pos, value)); + + timepos_t adj_pos; + + if (_time_domain == (*i)->when.time_domain()) { + adj_pos = (*i)->when + pos; + } else { + if (_time_domain == AudioTime) { + adj_pos = timepos_t (((*i)->when + pos).samples()); + } else { + adj_pos = timepos_t (((*i)->when + pos).beats()); + } + } + + _events.insert (where, new ControlEvent (adj_pos, value)); end = (*i)->when + pos; }