Consolidate loop en/disable calls
This commit is contained in:
parent
28accee44e
commit
c3fe0cd95e
@ -1430,7 +1430,7 @@ Session::auto_loop_changed (Location* location)
|
|||||||
|
|
||||||
if (rolling) {
|
if (rolling) {
|
||||||
|
|
||||||
if (play_loop) {
|
if (get_play_loop ()) {
|
||||||
|
|
||||||
if (_transport_sample < location->start() || _transport_sample > location->end()) {
|
if (_transport_sample < location->start() || _transport_sample > location->end()) {
|
||||||
|
|
||||||
@ -1563,15 +1563,9 @@ Session::set_auto_loop_location (Location* location)
|
|||||||
|
|
||||||
location->set_auto_loop (true, this);
|
location->set_auto_loop (true, this);
|
||||||
|
|
||||||
if (Config->get_loop_is_mode() && play_loop) {
|
if (Config->get_loop_is_mode() && get_play_loop ()) {
|
||||||
// set all tracks to use internal looping
|
/* set all tracks to use internal looping */
|
||||||
boost::shared_ptr<RouteList> rl = routes.reader ();
|
set_track_loop (true);
|
||||||
for (RouteList::iterator i = rl->begin(); i != rl->end(); ++i) {
|
|
||||||
boost::shared_ptr<Track> tr = boost::dynamic_pointer_cast<Track> (*i);
|
|
||||||
if (tr && !tr->is_private_route()) {
|
|
||||||
tr->set_loop (location);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* take care of our stuff first */
|
/* take care of our stuff first */
|
||||||
@ -1734,7 +1728,7 @@ Session::location_removed (Location *location)
|
|||||||
{
|
{
|
||||||
if (location->is_auto_loop()) {
|
if (location->is_auto_loop()) {
|
||||||
set_auto_loop_location (0);
|
set_auto_loop_location (0);
|
||||||
if (!play_loop) {
|
if (!get_play_loop ()) {
|
||||||
set_track_loop (false);
|
set_track_loop (false);
|
||||||
}
|
}
|
||||||
unset_play_loop ();
|
unset_play_loop ();
|
||||||
|
@ -233,7 +233,7 @@ Session::locate (samplepos_t target_sample, bool with_roll, bool with_flush, boo
|
|||||||
if (!transport_was_stopped &&
|
if (!transport_was_stopped &&
|
||||||
(!auto_play_legal || !config.get_auto_play()) &&
|
(!auto_play_legal || !config.get_auto_play()) &&
|
||||||
!with_roll &&
|
!with_roll &&
|
||||||
!(synced_to_engine() && play_loop) &&
|
!(synced_to_engine() && get_play_loop ()) &&
|
||||||
!(config.get_external_sync() && !synced_to_engine())) {
|
!(config.get_external_sync() && !synced_to_engine())) {
|
||||||
|
|
||||||
realtime_stop (false, true); // XXX paul - check if the 2nd arg is really correct
|
realtime_stop (false, true); // XXX paul - check if the 2nd arg is really correct
|
||||||
@ -289,7 +289,7 @@ Session::locate (samplepos_t target_sample, bool with_roll, bool with_flush, boo
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* cancel looped playback if transport pos outside of loop range */
|
/* cancel looped playback if transport pos outside of loop range */
|
||||||
if (play_loop) {
|
if (get_play_loop ()) {
|
||||||
|
|
||||||
Location* al = _locations->auto_loop_location();
|
Location* al = _locations->auto_loop_location();
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ Session::set_transport_speed (double speed, bool abort, bool clear_state, bool a
|
|||||||
|
|
||||||
/* we are stopped and we want to start rolling at speed 1 */
|
/* we are stopped and we want to start rolling at speed 1 */
|
||||||
|
|
||||||
if (Config->get_loop_is_mode() && play_loop) {
|
if (Config->get_loop_is_mode() && get_play_loop ()) {
|
||||||
|
|
||||||
Location *location = _locations->auto_loop_location();
|
Location *location = _locations->auto_loop_location();
|
||||||
|
|
||||||
@ -595,7 +595,7 @@ Session::start_transport ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case Recording:
|
case Recording:
|
||||||
if (!play_loop) {
|
if (!get_play_loop ()) {
|
||||||
disable_record (false);
|
disable_record (false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1562,7 +1562,7 @@ Session::set_play_loop (bool yn, bool change_transport_state)
|
|||||||
|
|
||||||
Location *loc;
|
Location *loc;
|
||||||
|
|
||||||
if (yn == play_loop || (actively_recording() && yn) || (loc = _locations->auto_loop_location()) == 0) {
|
if (yn == get_play_loop () || (actively_recording() && yn) || (loc = _locations->auto_loop_location()) == 0) {
|
||||||
/* nothing to do, or can't change loop status while recording */
|
/* nothing to do, or can't change loop status while recording */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1580,56 +1580,51 @@ Session::set_play_loop (bool yn, bool change_transport_state)
|
|||||||
play_loop = true;
|
play_loop = true;
|
||||||
have_looped = false;
|
have_looped = false;
|
||||||
|
|
||||||
if (loc) {
|
unset_play_range ();
|
||||||
|
/* set all tracks to use internal looping */
|
||||||
|
set_track_loop (true);
|
||||||
|
|
||||||
unset_play_range ();
|
merge_event (new SessionEvent (SessionEvent::AutoLoop, SessionEvent::Replace, loc->end(), loc->start(), 0.0f));
|
||||||
/* set all tracks to use internal looping */
|
|
||||||
set_track_loop (true);
|
|
||||||
|
|
||||||
merge_event (new SessionEvent (SessionEvent::AutoLoop, SessionEvent::Replace, loc->end(), loc->start(), 0.0f));
|
if (!Config->get_loop_is_mode()) {
|
||||||
|
/* args: positition, roll=true, flush=true, for_loop_end=false, force buffer, refill looping */
|
||||||
if (!Config->get_loop_is_mode()) {
|
/* set this so that when/if we stop for locate,
|
||||||
/* args: positition, roll=true, flush=true, for_loop_end=false, force buffer, refill looping */
|
we do not call unset_play_loop(). This is a
|
||||||
/* set this so that when/if we stop for locate,
|
crude mechanism. Got a better idea?
|
||||||
we do not call unset_play_loop(). This is a
|
*/
|
||||||
crude mechanism. Got a better idea?
|
loop_changing = true;
|
||||||
*/
|
TFSM_LOCATE (loc->start(), MustRoll, true, false, true);
|
||||||
loop_changing = true;
|
} else if (!transport_rolling()) {
|
||||||
TFSM_LOCATE (loc->start(), MustRoll, true, false, true);
|
/* loop-is-mode: not rolling, just locate to loop start */
|
||||||
} else if (!transport_rolling()) {
|
TFSM_LOCATE (loc->start(), MustStop, true, false, true);
|
||||||
/* loop-is-mode: not rolling, just locate to loop start */
|
|
||||||
TFSM_LOCATE (loc->start(), MustStop, true, false, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
TransportStateChange (); /* EMIT SIGNAL */
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
unset_play_loop ();
|
unset_play_loop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_TRACE (DEBUG::Transport, string_compose ("send TSC2 with speed = %1\n", _transport_speed));
|
DEBUG_TRACE (DEBUG::Transport, string_compose ("send TSC2 with speed = %1\n", _transport_speed));
|
||||||
TransportStateChange (); /* EMIT SIGNAL */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Session::unset_play_loop (bool change_transport_state)
|
Session::unset_play_loop (bool change_transport_state)
|
||||||
{
|
{
|
||||||
if (play_loop) {
|
if (!get_play_loop()) {
|
||||||
|
return;
|
||||||
play_loop = false;
|
|
||||||
clear_events (SessionEvent::AutoLoop);
|
|
||||||
set_track_loop (false);
|
|
||||||
|
|
||||||
/* likely need to flush track buffers: this will locate us to wherever we are */
|
|
||||||
|
|
||||||
if (change_transport_state && transport_rolling ()) {
|
|
||||||
TFSM_STOP (false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
overwrite_some_buffers (boost::shared_ptr<Route>(), LoopDisabled);
|
|
||||||
|
|
||||||
TransportStateChange (); /* EMIT SIGNAL */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
play_loop = false;
|
||||||
|
clear_events (SessionEvent::AutoLoop);
|
||||||
|
set_track_loop (false);
|
||||||
|
|
||||||
|
/* likely need to flush track buffers: this will locate us to wherever we are */
|
||||||
|
|
||||||
|
if (change_transport_state && transport_rolling ()) {
|
||||||
|
TFSM_STOP (false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
overwrite_some_buffers (boost::shared_ptr<Route>(), LoopDisabled);
|
||||||
|
TransportStateChange (); /* EMIT SIGNAL */
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Loading…
Reference in New Issue
Block a user