summaryrefslogtreecommitdiff
path: root/gtk2_ardour/editor_ops.cc
diff options
context:
space:
mode:
authorBen Loftis <ben@glw.com>2012-11-20 19:43:43 +0000
committerBen Loftis <ben@glw.com>2012-11-20 19:43:43 +0000
commitbeb3ec2d7a440308bce6e2db793d78f528c9fa85 (patch)
treee673c98d6d5011f78eebd2e4b18975e95773ec6c /gtk2_ardour/editor_ops.cc
parent38c10a4d2367111f3b9c7ac2223a8b633bfeb147 (diff)
Always Play Range is now Follow Edits, and is based on Mixbus implementation. Added menu item. Follow Edits button replaces Auto Play; removed the connector between play and play-range. Some Smart Mode changes came along for the ride but will be cleaned up shortly
git-svn-id: svn://localhost/ardour2/branches/3.0@13537 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/editor_ops.cc')
-rw-r--r--gtk2_ardour/editor_ops.cc54
1 files changed, 54 insertions, 0 deletions
diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc
index 5e2e2081b4..92b986d0d1 100644
--- a/gtk2_ardour/editor_ops.cc
+++ b/gtk2_ardour/editor_ops.cc
@@ -2169,6 +2169,55 @@ Editor::play_selection ()
_session->request_play_range (&selection->time, true);
}
+framepos_t
+Editor::get_preroll ()
+{
+ return 1.0 /*Config->get_edit_preroll_seconds()*/ * _session->frame_rate();
+}
+
+
+void
+Editor::maybe_locate_with_edit_preroll ( framepos_t location )
+{
+ if ( _session->transport_rolling() || !Config->get_always_play_range() )
+ return;
+
+ location -= get_preroll();
+
+ //don't try to locate before the beginning of time
+ if ( location < 0 )
+ location = 0;
+
+ //if follow_playhead is on, keep the playhead on the screen
+ if ( _follow_playhead )
+ if ( location < leftmost_frame )
+ location = leftmost_frame;
+
+ _session->request_locate( location );
+}
+
+void
+Editor::play_with_preroll ()
+{
+ if (selection->time.empty()) {
+ return;
+ } else {
+ framepos_t preroll = get_preroll();
+
+ framepos_t start = 0;
+ if (selection->time[clicked_selection].start > preroll)
+ start = selection->time[clicked_selection].start - preroll;
+
+ framepos_t end = selection->time[clicked_selection].end + preroll;
+
+ AudioRange ar (start, end, 0);
+ list<AudioRange> lar;
+ lar.push_back (ar);
+
+ _session->request_play_range (&lar, true);
+ }
+}
+
void
Editor::play_location (Location& location)
{
@@ -3237,8 +3286,10 @@ Editor::trim_region (bool front)
if (front) {
(*i)->region()->trim_front (where);
+ maybe_locate_with_edit_preroll ( where );
} else {
(*i)->region()->trim_end (where);
+ maybe_locate_with_edit_preroll ( where );
}
_session->add_command (new StatefulDiffCommand ((*i)->region()));
@@ -5384,6 +5435,9 @@ Editor::set_playhead_cursor ()
_session->request_locate (where, _session->transport_rolling());
}
}
+
+ if ( Config->get_always_play_range() )
+ cancel_time_selection();
}
void