From b18fbc8c68f545c1fa8982ebc639fedef1566340 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 25 Jul 2012 13:12:25 +0000 Subject: check for multiple tempo/meter marks at the same location, which somehow ardour2 allowed. don't handle it but at least report the error git-svn-id: svn://localhost/ardour2/branches/3.0@13082 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/tempo.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libs/ardour/tempo.cc') diff --git a/libs/ardour/tempo.cc b/libs/ardour/tempo.cc index e64a116933..f96bb5a91a 100644 --- a/libs/ardour/tempo.cc +++ b/libs/ardour/tempo.cc @@ -1012,6 +1012,7 @@ TempoMap::_extend_map (TempoSection* tempo, MeterSection* meter, */ goto set_metrics; } + } } @@ -1645,6 +1646,28 @@ TempoMap::set_state (const XMLNode& node, int /*version*/) metrics.sort (cmp); } + /* check for multiple tempo/meters at the same location, which + ardour2 somehow allowed. + */ + + Metrics::iterator prev = metrics.end(); + for (Metrics::iterator i = metrics.begin(); i != metrics.end(); ++i) { + if (prev != metrics.end()) { + if (dynamic_cast(*prev) && dynamic_cast(*i)) { + if ((*prev)->start() == (*i)->start()) { + error << string_compose (_("Multiple meter definitions found at %1"), (*prev)->start()) << endmsg; + return -1; + } + } else if (dynamic_cast(*prev) && dynamic_cast(*i)) { + if ((*prev)->start() == (*i)->start()) { + error << string_compose (_("Multiple tempo definitions found at %1"), (*prev)->start()) << endmsg; + return -1; + } + } + } + prev = i; + } + recompute_map (true, -1); } -- cgit v1.2.3