From 8b52b698104f336053f2228370139d821b7c43c1 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sat, 30 Apr 2016 10:54:32 -0400 Subject: [PATCH] make BasicUI (for control surfaces) loop toggle work like the GUI --- libs/surfaces/control_protocol/basic_ui.cc | 31 +++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index fc48b40175..161135390f 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -70,14 +70,39 @@ BasicUI::access_action ( std::string action_path ) void BasicUI::loop_toggle () { + if (!session) { + return; + } + + Location * looploc = session->locations()->auto_loop_location(); + + if (!looploc) { + return; + } + if (session->get_play_loop()) { + + /* looping enabled, our job is to disable it */ + session->request_play_loop (false); + } else { - session->request_play_loop (true); - if (!session->transport_rolling()) { - session->request_transport_speed (1.0); + + /* looping not enabled, our job is to enable it. + + loop-is-NOT-mode: this action always starts the transport rolling. + loop-IS-mode: this action simply sets the loop play mechanism, but + does not start transport. + */ + if (Config->get_loop_is_mode()) { + session->request_play_loop (true, false); + } else { + session->request_play_loop (true, true); } } + + //show the loop markers + looploc->set_hidden (false, this); } void