correctly set track loop status when locating away from loop range (and later, when coming back to the loop)
Conflicts: libs/ardour/ardour/session.h libs/ardour/session.cc libs/ardour/session_transport.cc
This commit is contained in:
parent
cc7f9d7f46
commit
aa5cf04ca6
@ -1360,6 +1360,7 @@ class LIBARDOUR_API Session : public PBD::StatefulDestructible, public PBD::Scop
|
||||
void post_transport ();
|
||||
void engine_halted ();
|
||||
void xrun_recovery ();
|
||||
void set_track_loop (bool);
|
||||
|
||||
/* These are synchronous and so can only be called from within the process
|
||||
* cycle
|
||||
|
@ -995,6 +995,7 @@ AudioDiskstream::read (Sample* buf, Sample* mixdown_buffer, float* gain_buffer,
|
||||
if (loc && start >= loop_end) {
|
||||
start = loop_start + ((start - loop_start) % loop_length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (reversed) {
|
||||
|
@ -1440,6 +1440,7 @@ Session::location_removed (Location *location)
|
||||
{
|
||||
if (location->is_auto_loop()) {
|
||||
set_auto_loop_location (0);
|
||||
set_track_loop (false);
|
||||
}
|
||||
|
||||
if (location->is_auto_punch()) {
|
||||
|
@ -384,6 +384,7 @@ Session::butler_transport_work ()
|
||||
}
|
||||
|
||||
if (ptw & PostTransportLocate) {
|
||||
DEBUG_TRACE (DEBUG::Transport, "nonrealtime locate invoked from BTW\n");
|
||||
non_realtime_locate ();
|
||||
}
|
||||
|
||||
@ -445,6 +446,18 @@ Session::non_realtime_overwrite (int on_entry, bool& finished)
|
||||
void
|
||||
Session::non_realtime_locate ()
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Transport, string_compose ("locate tracks to %1\n", _transport_frame));
|
||||
|
||||
if (Config->get_loop_is_mode() && get_play_loop()) {
|
||||
Location *loc = _locations->auto_loop_location();
|
||||
if (!loc || (_transport_frame < loc->start() || _transport_frame >= loc->end())) {
|
||||
/* jumped out of loop range: stop tracks from looping,
|
||||
but leave loop (mode) enabled.
|
||||
*/
|
||||
set_track_loop (false);
|
||||
}
|
||||
}
|
||||
|
||||
boost::shared_ptr<RouteList> rl = routes.reader();
|
||||
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||
(*i)->non_realtime_locate (_transport_frame);
|
||||
@ -459,7 +472,6 @@ Session::non_realtime_locate ()
|
||||
clear_clicks ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Session::non_realtime_stop (bool abort, int on_entry, bool& finished)
|
||||
{
|
||||
@ -752,13 +764,24 @@ Session::unset_play_loop ()
|
||||
play_loop = false;
|
||||
clear_events (SessionEvent::AutoLoop);
|
||||
clear_events (SessionEvent::AutoLoopDeclick);
|
||||
set_track_loop (false);
|
||||
}
|
||||
|
||||
void
|
||||
Session::set_track_loop (bool yn)
|
||||
{
|
||||
Location* loc = _locations->auto_loop_location ();
|
||||
|
||||
if (!loc) {
|
||||
yn = false;
|
||||
}
|
||||
|
||||
// set all tracks to NOT use internal looping
|
||||
boost::shared_ptr<RouteList> rl = routes.reader ();
|
||||
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
|
||||
if (tr && !tr->hidden()) {
|
||||
tr->set_loop (0);
|
||||
tr->set_loop (yn ? loc : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -793,23 +816,10 @@ Session::set_play_loop (bool yn, double speed)
|
||||
|
||||
if (Config->get_seamless_loop()) {
|
||||
// set all tracks to use internal looping
|
||||
boost::shared_ptr<RouteList> rl = routes.reader ();
|
||||
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
|
||||
if (tr && !tr->hidden()) {
|
||||
tr->set_loop (loc);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
set_track_loop (true);
|
||||
} else {
|
||||
// set all tracks to NOT use internal looping
|
||||
boost::shared_ptr<RouteList> rl = routes.reader ();
|
||||
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
|
||||
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
|
||||
if (tr && !tr->hidden()) {
|
||||
tr->set_loop (0);
|
||||
}
|
||||
}
|
||||
set_track_loop (false);
|
||||
}
|
||||
|
||||
/* Put the delick and loop events in into the event list. The declick event will
|
||||
@ -1043,6 +1053,8 @@ Session::locate (framepos_t target_frame, bool with_roll, bool with_flush, bool
|
||||
|
||||
if (!Config->get_loop_is_mode()) {
|
||||
set_play_loop (false, _transport_speed);
|
||||
} else {
|
||||
/* handled in ::non_realtime_locate() */
|
||||
}
|
||||
|
||||
} else if (_transport_frame == al->start()) {
|
||||
|
Loading…
Reference in New Issue
Block a user