summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-07-25 13:12:25 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-07-25 13:12:25 +0000
commitb18fbc8c68f545c1fa8982ebc639fedef1566340 (patch)
tree0e753e7df155e05e4d4f764328c02d0a3bdb28d5 /libs
parentce17c5727c7b5de67dc0f1d7590226347289a05c (diff)
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
Diffstat (limited to 'libs')
-rw-r--r--libs/ardour/tempo.cc23
1 files changed, 23 insertions, 0 deletions
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<MeterSection*>(*prev) && dynamic_cast<MeterSection*>(*i)) {
+ if ((*prev)->start() == (*i)->start()) {
+ error << string_compose (_("Multiple meter definitions found at %1"), (*prev)->start()) << endmsg;
+ return -1;
+ }
+ } else if (dynamic_cast<TempoSection*>(*prev) && dynamic_cast<TempoSection*>(*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);
}