change semantics of 4th argument to Session::locate to mean "this locate is connected with play-loop just being enabled"

This commit is contained in:
Paul Davis 2015-09-24 13:40:55 -04:00
parent 601770837e
commit 9f8fe4b0bc
2 changed files with 31 additions and 40 deletions

View file

@ -1466,7 +1466,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
void flush_all_inserts (); void flush_all_inserts ();
int micro_locate (framecnt_t distance); int micro_locate (framecnt_t distance);
void locate (framepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true); void locate (framepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true);
void start_locate (framepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false); void start_locate (framepos_t, bool with_roll, bool with_flush, bool for_loop_enabled=false, bool force=false);
void force_locate (framepos_t frame, bool with_roll = false); void force_locate (framepos_t frame, bool with_roll = false);
void set_track_speed (Track *, double speed); void set_track_speed (Track *, double speed);
void set_transport_speed (double speed, framepos_t destination_frame, bool abort = false, bool clear_state = false, bool as_default = false); void set_transport_speed (double speed, framepos_t destination_frame, bool abort = false, bool clear_state = false, bool as_default = false);

View file

@ -958,11 +958,11 @@ Session::set_play_loop (bool yn, double speed)
rolling, do not locate to loop start. rolling, do not locate to loop start.
*/ */
if (!transport_rolling() && (speed != 0.0)) { if (!transport_rolling() && (speed != 0.0)) {
start_locate (loc->start(), true, true, false, Config->get_seamless_loop()); start_locate (loc->start(), true, true, false, true);
} }
} else { } else {
if (speed != 0.0) { if (speed != 0.0) {
start_locate (loc->start(), true, true, false, Config->get_seamless_loop()); start_locate (loc->start(), true, true, false, true);
} }
} }
} }
@ -986,7 +986,7 @@ Session::flush_all_inserts ()
} }
void void
Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush, bool with_loop, bool force) Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush, bool for_loop_enabled, bool force)
{ {
if (target_frame < 0) { if (target_frame < 0) {
error << _("Locate called for negative sample position - ignored") << endmsg; error << _("Locate called for negative sample position - ignored") << endmsg;
@ -1007,7 +1007,7 @@ Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush,
will use the incorrect _transport_frame and report an old will use the incorrect _transport_frame and report an old
and incorrect time to Jack transport and incorrect time to Jack transport
*/ */
locate (target_frame, with_roll, with_flush, with_loop, force); locate (target_frame, with_roll, with_flush, for_loop_enabled, force);
} }
/* tell JACK to change transport position, and we will /* tell JACK to change transport position, and we will
@ -1023,7 +1023,7 @@ Session::start_locate (framepos_t target_frame, bool with_roll, bool with_flush,
} }
} else { } else {
locate (target_frame, with_roll, with_flush, with_loop, force); locate (target_frame, with_roll, with_flush, for_loop_enabled, force);
} }
} }
@ -1051,7 +1051,7 @@ Session::micro_locate (framecnt_t distance)
/** @param with_mmc true to send a MMC locate command when the locate is done */ /** @param with_mmc true to send a MMC locate command when the locate is done */
void void
Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool for_seamless_loop, bool force, bool with_mmc) Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool for_loop_enabled, bool force, bool with_mmc)
{ {
bool need_butler = false; bool need_butler = false;
@ -1063,14 +1063,10 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
* changes in the value of _transport_frame. * changes in the value of _transport_frame.
*/ */
DEBUG_TRACE (DEBUG::Transport, string_compose ("rt-locate to %1, roll %2 flush %3 seamless %4 force %5 mmc %6\n", DEBUG_TRACE (DEBUG::Transport, string_compose ("rt-locate to %1, roll %2 flush %3 loop-enabled %4 force %5 mmc %6\n",
target_frame, with_roll, with_flush, for_seamless_loop, force, with_mmc)); target_frame, with_roll, with_flush, for_loop_enabled, force, with_mmc));
if (actively_recording() && !for_seamless_loop) { if (!force && _transport_frame == target_frame && !loop_changing && !for_loop_enabled) {
return;
}
if (!force && _transport_frame == target_frame && !loop_changing && !for_seamless_loop) {
if (with_roll) { if (with_roll) {
set_transport_speed (1.0, 0, false); set_transport_speed (1.0, 0, false);
} }
@ -1079,7 +1075,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
return; return;
} }
if (_transport_speed && !for_seamless_loop) { if (_transport_speed && !(for_loop_enabled && Config->get_seamless_loop())) {
/* Schedule a declick. We'll be called again when its done. /* Schedule a declick. We'll be called again when its done.
We only do it this way for ordinary locates, not those We only do it this way for ordinary locates, not those
due to **seamless** loops. due to **seamless** loops.
@ -1122,7 +1118,7 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
realtime_locate (); realtime_locate ();
} }
if (force || !for_seamless_loop || loop_changing) { if (force || !for_loop_enabled || loop_changing) {
PostTransportWork todo = PostTransportLocate; PostTransportWork todo = PostTransportLocate;
@ -1189,8 +1185,6 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
// located to start of loop - this is looping, basically // located to start of loop - this is looping, basically
if (for_seamless_loop) {
if (!have_looped) { if (!have_looped) {
/* first time */ /* first time */
if (_last_roll_location != al->start()) { if (_last_roll_location != al->start()) {
@ -1204,8 +1198,6 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
} }
// this is only necessary for seamless looping
boost::shared_ptr<RouteList> rl = routes.reader(); boost::shared_ptr<RouteList> rl = routes.reader();
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) { for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
@ -1216,7 +1208,6 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
tr->transport_looped (_transport_frame); tr->transport_looped (_transport_frame);
} }
} }
}
have_looped = true; have_looped = true;
TransportLooped(); // EMIT SIGNAL TransportLooped(); // EMIT SIGNAL