From 7dadb1407b55e96a8753a3a7b185d708037c89e7 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 3 Jun 2022 10:50:46 -0600 Subject: [PATCH] temporal: when copying points between TempoMaps do not double-count MusicTimePoints They were counted as tempos, and meters, and bartimes individually, which generated new tempo and meter points in the map, which is incorrect. --- libs/temporal/tempo.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libs/temporal/tempo.cc b/libs/temporal/tempo.cc index 48c1b2c2b7..49515d678a 100644 --- a/libs/temporal/tempo.cc +++ b/libs/temporal/tempo.cc @@ -743,12 +743,18 @@ TempoMap::copy_points (TempoMap const & other) p.reserve (other._meters.size() + other._tempos.size() + other._bartimes.size()); for (Meters::const_iterator m = other._meters.begin(); m != other._meters.end(); ++m) { + if (dynamic_cast (&*m)) { + continue; + } MeterPoint* mp = new MeterPoint (*m); _meters.push_back (*mp); p.push_back (mp); } for (Tempos::const_iterator t = other._tempos.begin(); t != other._tempos.end(); ++t) { + if (dynamic_cast (&*t)) { + continue; + } TempoPoint* tp = new TempoPoint (*t); _tempos.push_back (*tp); p.push_back (tp); @@ -757,6 +763,8 @@ TempoMap::copy_points (TempoMap const & other) for (MusicTimes::const_iterator mt = other._bartimes.begin(); mt != other._bartimes.end(); ++mt) { MusicTimePoint* mtp = new MusicTimePoint (*mt); _bartimes.push_back (*mtp); + _tempos.push_back (*mtp); + _meters.push_back (*mtp); p.push_back (mtp); }