diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 7cf0654b3e..44cc270c4a 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -1000,7 +1000,7 @@ ARDOUR_UI::transport_stop () return; } - if (Config->get_auto_loop()) { + if (session->get_play_loop ()) { session->request_play_loop (false); } @@ -1054,7 +1054,7 @@ ARDOUR_UI::transport_roll () rolling = session->transport_rolling (); - if (Config->get_auto_loop()) { + if (session->get_play_loop()) { session->request_play_loop (false); auto_loop_button.set_active (false); roll_button.set_active (true); @@ -1072,7 +1072,7 @@ void ARDOUR_UI::transport_loop() { if (session) { - if (Config->get_auto_loop()) { + if (session->get_play_loop()) { if (session->transport_rolling()) { Location * looploc = session->locations()->auto_loop_location(); if (looploc) { diff --git a/gtk2_ardour/ardour_ui2.cc b/gtk2_ardour/ardour_ui2.cc index 7f724312aa..25fe144233 100644 --- a/gtk2_ardour/ardour_ui2.cc +++ b/gtk2_ardour/ardour_ui2.cc @@ -139,7 +139,7 @@ ARDOUR_UI::transport_rolling () roll_button.set_active (false); auto_loop_button.set_active (false); - } else if (Config->get_auto_loop ()) { + } else if (session->get_play_loop ()) { auto_loop_button.set_active (true); play_selection_button.set_active (false); roll_button.set_active (false); diff --git a/gtk2_ardour/ardour_ui_options.cc b/gtk2_ardour/ardour_ui_options.cc index 82147f04ee..707d3109f7 100644 --- a/gtk2_ardour/ardour_ui_options.cc +++ b/gtk2_ardour/ardour_ui_options.cc @@ -280,7 +280,7 @@ void ARDOUR_UI::toggle_session_auto_loop () { if (session) { - if (Config->get_auto_loop()) { + if (session->get_play_loop()) { if (session->transport_rolling()) { transport_roll(); } else { @@ -769,8 +769,6 @@ ARDOUR_UI::parameter_changed (const char* parameter_name) map_solo_model (); } else if (PARAM_IS ("auto-play")) { ActionManager::map_some_state ("Transport", "ToggleAutoPlay", &Configuration::get_auto_play); - } else if (PARAM_IS ("auto-loop")) { - ActionManager::map_some_state ("Transport", "Loop", &Configuration::get_auto_loop); } else if (PARAM_IS ("auto-return")) { ActionManager::map_some_state ("Transport", "ToggleAutoReturn", &Configuration::get_auto_return); } else if (PARAM_IS ("auto-input")) { diff --git a/gtk2_ardour/editor_markers.cc b/gtk2_ardour/editor_markers.cc index 46383149a3..6da479bafe 100644 --- a/gtk2_ardour/editor_markers.cc +++ b/gtk2_ardour/editor_markers.cc @@ -925,7 +925,7 @@ Editor::update_loop_range_view (bool visibility) Location* tll; - if (Config->get_auto_loop() && ((tll = transport_loop_location()) != 0)) { + if (session->get_play_loop() && ((tll = transport_loop_location()) != 0)) { double x1 = frame_to_pixel (tll->start()); double x2 = frame_to_pixel (tll->end()); diff --git a/gtk2_ardour/editor_ops.cc b/gtk2_ardour/editor_ops.cc index 280804c94f..ec2435c67b 100644 --- a/gtk2_ardour/editor_ops.cc +++ b/gtk2_ardour/editor_ops.cc @@ -1840,7 +1840,7 @@ Editor::toggle_playback (bool with_abort) if (session->transport_rolling()) { session->request_stop (with_abort); - if (Config->get_auto_loop()) { + if (session->get_play_loop()) { session->request_play_loop (false); } } else { diff --git a/libs/ardour/ardour/configuration_vars.h b/libs/ardour/ardour/configuration_vars.h index fe65e9d433..8044190066 100644 --- a/libs/ardour/ardour/configuration_vars.h +++ b/libs/ardour/ardour/configuration_vars.h @@ -80,7 +80,6 @@ CONFIG_VARIABLE (std::string, click_emphasis_sound, "click-emphasis-sound", "") CONFIG_VARIABLE (bool, auto_play, "auto-play", false) CONFIG_VARIABLE (bool, auto_return, "auto-return", false) CONFIG_VARIABLE (bool, auto_input, "auto-input", true) -CONFIG_VARIABLE (bool, auto_loop, "auto-loop", false) CONFIG_VARIABLE (bool, punch_in, "punch-in", false) CONFIG_VARIABLE (bool, punch_out, "punch-out", false) CONFIG_VARIABLE (bool, plugins_stop_with_transport, "plugins-stop-with-transport", false) diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h index cdc79164e6..c3f2dc30bf 100644 --- a/libs/ardour/ardour/session.h +++ b/libs/ardour/ardour/session.h @@ -346,7 +346,10 @@ class Session : public PBD::StatefulDestructible void request_bounded_roll (nframes_t start, nframes_t end); void request_stop (bool abort = false); void request_locate (nframes_t frame, bool with_roll = false); + void request_play_loop (bool yn); + bool get_play_loop () const { return play_loop; } + nframes_t last_transport_start() const { return _last_roll_location; } void goto_end () { request_locate (end_location->start(), false);} void goto_start () { request_locate (start_location->start(), false); } diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc index b46972ef2e..e09a59d42f 100644 --- a/libs/ardour/location.cc +++ b/libs/ardour/location.cc @@ -420,17 +420,19 @@ Locations::clear () { { Glib::Mutex::Lock lm (lock); - LocationList::iterator tmp; + for (LocationList::iterator i = locations.begin(); i != locations.end(); ) { - tmp = i; + + LocationList::iterator tmp = i; ++tmp; + if (!(*i)->is_end() && !(*i)->is_start()) { locations.erase (i); } + i = tmp; } - locations.clear (); current_location = 0; } @@ -579,7 +581,7 @@ Locations::set_state (const XMLNode& node) nlist = node.children(); - locations.clear (); // dangerous + locations.clear (); current_location = 0; { diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 6e82257806..b8a964668f 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -54,7 +54,7 @@ BasicUI::register_thread (std::string name) void BasicUI::loop_toggle () { - if (Config->get_auto_loop()) { + if (session->get_play_loop()) { session->request_play_loop (false); } else { session->request_play_loop (true); @@ -106,7 +106,7 @@ BasicUI::transport_play (bool from_last_start) { bool rolling = session->transport_rolling (); - if (Config->get_auto_loop()) { + if (session->get_play_loop()) { session->request_play_loop (false); }