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 | |
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')
-rw-r--r-- | libs/ardour/ardour/region.h | 1 | ||||
-rw-r--r-- | libs/ardour/playlist.cc | 1 | ||||
-rw-r--r-- | libs/ardour/region.cc | 13 |
3 files changed, 10 insertions, 5 deletions
diff --git a/libs/ardour/ardour/region.h b/libs/ardour/ardour/region.h index 1e2bbe3581..3dbcc55570 100644 --- a/libs/ardour/ardour/region.h +++ b/libs/ardour/ardour/region.h @@ -346,6 +346,7 @@ class Region PBD::Property<framepos_t> _start; PBD::Property<framecnt_t> _length; PBD::Property<framepos_t> _position; + /** Sync position relative to the start of our file */ PBD::Property<framepos_t> _sync_position; PBD::Property<layer_t> _layer; PBD::Property<framepos_t> _ancestral_start; diff --git a/libs/ardour/playlist.cc b/libs/ardour/playlist.cc index 1b2d64baba..4a5d65c903 100644 --- a/libs/ardour/playlist.cc +++ b/libs/ardour/playlist.cc @@ -1999,7 +1999,6 @@ Playlist::find_next_region (framepos_t frame, RegionPoint point, int dir) break; case SyncPoint: pos = r->sync_position (); - // r->adjust_to_sync (r->first_frame()); break; } 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; } } |