diff options
author | Carl Hetherington <carl@carlh.net> | 2010-08-29 01:08:07 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-08-29 01:08:07 +0000 |
commit | bce90b1802565f62288a5081929244d60e15a5bd (patch) | |
tree | 4112e1a8c3070a38cb2d35a008929ffcb684b52c /libs/ardour/region.cc | |
parent | 8f093b0eaa91e0e07128e3e906c727ce5e379ab2 (diff) |
Fix up some inconsistencies in handling of region sync points.
git-svn-id: svn://localhost/ardour2/branches/3.0@7706 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/region.cc')
-rw-r--r-- | libs/ardour/region.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libs/ardour/region.cc b/libs/ardour/region.cc index 4ce1ae282b..73f42bc4eb 100644 --- a/libs/ardour/region.cc +++ b/libs/ardour/region.cc @@ -1013,9 +1013,13 @@ Region::set_position_locked (bool yn) } } +/** Set the region's sync point. + * @param absolute_pos Session time. + */ void Region::set_sync_position (framepos_t absolute_pos) { + /* position within our file */ framepos_t const file_pos = _start + (absolute_pos - _position); if (file_pos != _sync_position) { @@ -1040,11 +1044,10 @@ Region::clear_sync_position () } } +/* @return the sync point relative the first frame of the region */ framepos_t Region::sync_offset (int& dir) const { - /* returns the sync point relative the first frame of the region */ - if (sync_marked()) { if (_sync_position > _start) { dir = 1; @@ -1082,13 +1085,15 @@ Region::adjust_to_sync (framepos_t pos) const return pos; } +/** @return Sync position in session time */ framepos_t Region::sync_position() const { if (sync_marked()) { - return _sync_position; + return _position - _start + _sync_position; } else { - return _start; + /* if sync has not been marked, use the start of the region */ + return _position; } } |