summaryrefslogtreecommitdiff
path: root/libs/ardour/region.cc
diff options
context:
space:
mode:
authornick_m <mainsbridge@gmail.com>2016-02-06 06:29:06 +1100
committernick_m <mainsbridge@gmail.com>2016-05-27 23:38:10 +1000
commitd14c660261c2534bfef77be6d66092f424e562ee (patch)
tree0252fc5980e10bfcf836917a17e1fe169d607df5 /libs/ardour/region.cc
parent87d49cd6ec88d7c89884735a450d79631466b82a (diff)
Tempo ramps - fix save/restore of region position_lock_style.
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r--libs/ardour/region.cc30
1 files changed, 13 insertions, 17 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc
index 8db3aa097a..ca178a9f7b 100644
--- a/libs/ardour/region.cc
+++ b/libs/ardour/region.cc
@@ -1197,9 +1197,8 @@ Region::state ()
/* note: flags are stored by derived classes */
if (_position_lock_style != AudioTime) {
- stringstream str;
- str << _beat;
- node->add_property ("beat", str.str());
+ snprintf (buf, sizeof(buf), "%lf", _beat);
+ node->add_property ("beat", buf);
}
for (uint32_t n=0; n < _sources.size(); ++n) {
@@ -1270,26 +1269,23 @@ Region::_set_state (const XMLNode& node, int /*version*/, PropertyChange& what_c
if (_position_lock_style == MusicTime) {
if ((prop = node.property ("bbt-position")) == 0) {
- /* missing BBT info, revert to audio time locking */
- _position_lock_style = AudioTime;
+ if ((prop = node.property ("beat")) == 0) {
+ /* missing BBT info, revert to audio time locking */
+ _position_lock_style = AudioTime;
+ } else {
+ if (sscanf (prop->value().c_str(), "%lf", &_beat) != 1) {
+ _position_lock_style = AudioTime;
+ }
+ }
+
} else {
if (sscanf (prop->value().c_str(), "%d|%d|%d",
&bbt_time.bars,
&bbt_time.beats,
&bbt_time.ticks) != 3) {
_position_lock_style = AudioTime;
- }
- _beat = _session.tempo_map().bbt_to_beats (bbt_time);
- }
- }
-
- if (_position_lock_style == MusicTime) {
- if ((prop = node.property ("beat")) == 0) {
- /* missing BBT info, revert to audio time locking */
- _position_lock_style = AudioTime;
- } else {
- if (sscanf (prop->value().c_str(), "%lf", &_beat) != 1) {
- _position_lock_style = AudioTime;
+ } else {
+ _beat = _session.tempo_map().bbt_to_beats (bbt_time);
}
}
}