Tweak behavior of Play-With-Preroll action

This commit is contained in:
Ben Loftis 2016-12-19 12:50:51 -06:00
parent 628c99d555
commit 3e214eb4ea
2 changed files with 16 additions and 7 deletions

View File

@ -391,7 +391,7 @@ ARDOUR_UI::install_actions ()
act = global_actions.register_action (transport_actions, X_("PlaySelection"), _("Play Selection"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_selection));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);
act = global_actions.register_action (transport_actions, X_("PlayPreroll"), _("Play Selection w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_preroll));
act = global_actions.register_action (transport_actions, X_("PlayPreroll"), _("Play w/Preroll"), sigc::mem_fun(*this, &ARDOUR_UI::transport_play_preroll));
ActionManager::session_sensitive_actions.push_back (act);
ActionManager::transport_sensitive_actions.push_back (act);

View File

@ -2626,13 +2626,12 @@ Editor::maybe_locate_with_edit_preroll ( framepos_t location )
void
Editor::play_with_preroll ()
{
{
framepos_t preroll = get_preroll();
framepos_t start, end;
if (!get_selection_extents ( start, end))
return;
framepos_t preroll = get_preroll();
framepos_t start, end;
if ( UIConfiguration::instance().get_follow_edits() && get_selection_extents ( start, end) ) {
framepos_t ret = start;
if (start > preroll)
start = start - preroll;
@ -2643,6 +2642,16 @@ Editor::play_with_preroll ()
lar.push_back (ar);
_session->request_play_range (&lar, true);
_session->set_requested_return_frame( ret ); //force auto-return to return to range start, without the preroll
} else {
framepos_t ph = playhead_cursor->current_frame ();
framepos_t start;
if (ph > preroll)
start = ph - preroll;
else
start = 0;
_session->request_locate ( start, true);
_session->set_requested_return_frame( ph ); //force auto-return to return to playhead location, without the preroll
}
}