summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/editor_ops.cc3
-rw-r--r--gtk2_ardour/editor_regions.cc12
-rw-r--r--libs/ardour/ardour/region.h1
-rw-r--r--libs/ardour/playlist.cc1
-rw-r--r--libs/ardour/region.cc13
5 files changed, 16 insertions, 14 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index d540134f17..9f2f29b6d5 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -620,7 +620,6 @@ Editor::build_region_boundary_cache ()
case SyncPoint:
rpos = r->sync_position ();
- //r->adjust_to_sync (r->first_frame());
break;
default:
@@ -713,7 +712,6 @@ Editor::find_next_region (framepos_t frame, RegionPoint point, int32_t dir, Trac
case SyncPoint:
rpos = r->sync_position ();
- // r->adjust_to_sync (r->first_frame());
break;
}
@@ -884,7 +882,6 @@ Editor::cursor_to_region_point (EditorCursor* cursor, RegionPoint point, int32_t
case SyncPoint:
pos = r->sync_position ();
- // r->adjust_to_sync (r->first_frame());
break;
}
diff --git a/gtk2_ardour/editor_regions.cc b/gtk2_ardour/editor_regions.cc
index 1acb580583..91cebff090 100644
--- a/gtk2_ardour/editor_regions.cc
+++ b/gtk2_ardour/editor_regions.cc
@@ -656,7 +656,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
sprintf (end_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
_session->timecode_time (region->length(), timecode);
sprintf (length_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
- _session->timecode_time (region->sync_position() + region->position(), timecode);
+ _session->timecode_time (region->sync_position(), timecode);
sprintf (sync_str, "%02d:%02d:%02d:%02d", timecode.hours, timecode.minutes, timecode.seconds, timecode.frames);
if (audioRegion && !fades_in_seconds) {
@@ -675,7 +675,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
sprintf (end_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
_session->tempo_map().bbt_time (region->length(), bbt);
sprintf (length_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
- _session->tempo_map().bbt_time (region->sync_position() + region->position(), bbt);
+ _session->tempo_map().bbt_time (region->sync_position(), bbt);
sprintf (sync_str, "%03d|%02d|%04d" , bbt.bars, bbt.beats, bbt.ticks);
if (audioRegion && !fades_in_seconds) {
@@ -716,7 +716,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
secs = left / (float) _session->frame_rate();
sprintf (length_str, "%02d:%02d:%06.3f", hrs, mins, secs);
- left = region->sync_position() + region->position();
+ left = region->sync_position();
hrs = (int) floor (left / (_session->frame_rate() * 60.0f * 60.0f));
left -= (nframes_t) floor (hrs * _session->frame_rate() * 60.0f * 60.0f);
mins = (int) floor (left / (_session->frame_rate() * 60.0f));
@@ -748,7 +748,7 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
snprintf (start_str, sizeof (start_str), "%" PRId64, region->position());
snprintf (end_str, sizeof (end_str), "%" PRId64, (region->last_frame()));
snprintf (length_str, sizeof (length_str), "%" PRId64, region->length());
- snprintf (sync_str, sizeof (sync_str), "%" PRId64, region->sync_position() + region->position());
+ snprintf (sync_str, sizeof (sync_str), "%" PRId64, region->sync_position());
if (audioRegion && !fades_in_seconds) {
snprintf (fadein_str, sizeof (fadein_str), "%u", uint (audioRegion->fade_in()->back()->when));
@@ -804,9 +804,9 @@ EditorRegions::populate_row (boost::shared_ptr<Region> region, TreeModel::Row co
row[_columns.start] = start_str;
row[_columns.end] = end_str;
- if (region->sync_position() == 0) {
+ if (region->sync_position() == region->position()) {
row[_columns.sync] = _("Start");
- } else if (region->sync_position() == region->length() - 1) {
+ } else if (region->sync_position() == (region->position() + region->length() - 1)) {
row[_columns.sync] = _("End");
} else {
row[_columns.sync] = sync_str;
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;
}
}