From d00ab0221ad6e257fe9868890b54324454b6462b Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 13 Apr 2015 16:20:40 +0200 Subject: [PATCH] allow to set/change loop-range via OSC --- libs/surfaces/control_protocol/basic_ui.cc | 14 ++++++++++++++ .../control_protocol/control_protocol/basic_ui.h | 1 + libs/surfaces/osc/osc.cc | 1 + libs/surfaces/osc/osc.h | 1 + 4 files changed, 17 insertions(+) diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 98e7adf949..bf6bb25f2c 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -79,6 +79,20 @@ BasicUI::loop_toggle () } } +void +BasicUI::loop_location (framepos_t start, framepos_t end) +{ + Location* tll; + if ((tll = session->locations()->auto_loop_location()) == 0) { + Location* loc = new Location (*session, start, end, _("Loop"), Location::IsAutoLoop); + session->locations()->add (loc, true); + session->set_auto_loop_location (loc); + } else { + tll->set_hidden (false, this); + tll->set (start, end); + } +} + void BasicUI::goto_start () { diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index 277a7f8ecd..6053614a0c 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -49,6 +49,7 @@ class LIBCONTROLCP_API BasicUI { /* transport control */ void loop_toggle (); + void loop_location (framepos_t start, framepos_t end); void access_action ( std::string action_path ); static PBD::Signal2 AccessAction; void goto_start (); diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 5def3149b5..1fcf64bd30 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -344,6 +344,7 @@ OSC::register_callbacks() REGISTER_CALLBACK (serv, "/ardour/add_marker", "", add_marker); REGISTER_CALLBACK (serv, "/ardour/access_action", "s", access_action); REGISTER_CALLBACK (serv, "/ardour/loop_toggle", "", loop_toggle); + REGISTER_CALLBACK (serv, "/ardour/loop_location", "ii", loop_location); REGISTER_CALLBACK (serv, "/ardour/goto_start", "", goto_start); REGISTER_CALLBACK (serv, "/ardour/goto_end", "", goto_end); REGISTER_CALLBACK (serv, "/ardour/rewind", "", rewind); diff --git a/libs/surfaces/osc/osc.h b/libs/surfaces/osc/osc.h index 2479eceaff..884b89c6a2 100644 --- a/libs/surfaces/osc/osc.h +++ b/libs/surfaces/osc/osc.h @@ -208,6 +208,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI } PATH_CALLBACK2(locate,i,i); + PATH_CALLBACK2(loop_location,i,i); PATH_CALLBACK2(route_mute,i,i); PATH_CALLBACK2(route_solo,i,i); PATH_CALLBACK2(route_recenable,i,i);