summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2019-11-02 16:20:32 -0600
committerPaul Davis <paul@linuxaudiosystems.com>2019-11-02 16:32:18 -0600
commit7b25a8994412003562d360ef130bedd5d97d060f (patch)
tree7ab6d89c93b2fce1db38261a925b141e60e426ca
parent3e443bc2373076bcefb22241faa634f91909c942 (diff)
part 1 of replicating semantics of ARDOUR_UI::toggle_roll() in BasicUI::toggle_roll()
This can be done better, even without sharing code
-rw-r--r--libs/surfaces/control_protocol/basic_ui.cc66
-rw-r--r--libs/surfaces/control_protocol/control_protocol/basic_ui.h2
2 files changed, 62 insertions, 6 deletions
diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc
index a6bf65f55b..2f0e4732e8 100644
--- a/libs/surfaces/control_protocol/basic_ui.cc
+++ b/libs/surfaces/control_protocol/basic_ui.cc
@@ -29,6 +29,7 @@
#include "ardour/session.h"
#include "ardour/location.h"
#include "ardour/tempo.h"
+#include "ardour/transport_master_manager.h"
#include "ardour/utils.h"
#include "control_protocol/basic_ui.h"
@@ -205,6 +206,8 @@ BasicUI::transport_stop ()
void
BasicUI::transport_play (bool from_last_start)
{
+ /* ::toggle_roll() is smarter and preferred */
+
if (!session) {
return;
}
@@ -486,12 +489,65 @@ BasicUI::toggle_click ()
}
void
-BasicUI::toggle_roll ()
+BasicUI::toggle_roll (bool roll_out_of_bounded_mode)
{
- if (session->transport_rolling()) {
- transport_stop ();
- } else {
- transport_play (false);
+ /* TO BE KEPT IN SYNC WITH ARDOUR_UI::toggle_roll() */
+
+ if (!session) {
+ return;
+ }
+
+ if (session->is_auditioning()) {
+ session->cancel_audition ();
+ return;
+ }
+
+ if (session->config.get_external_sync()) {
+ switch (TransportMasterManager::instance().current()->type()) {
+ case Engine:
+ break;
+ default:
+ /* transport controlled by the master */
+ return;
+ }
+ }
+
+ bool rolling = session->transport_rolling();
+
+ if (rolling) {
+
+ if (roll_out_of_bounded_mode) {
+ /* drop out of loop/range playback but leave transport rolling */
+
+ if (session->get_play_loop()) {
+
+ if (session->actively_recording()) {
+ /* actually stop transport because
+ otherwise the captured data will make
+ no sense.
+ */
+ session->request_play_loop (false, true);
+
+ } else {
+ session->request_play_loop (false, false);
+ }
+
+ } else if (session->get_play_range ()) {
+
+ session->request_cancel_play_range ();
+ }
+
+ } else {
+ session->request_stop (true, true);
+ }
+
+ } else { /* not rolling */
+
+ if (session->get_play_loop() && Config->get_loop_is_mode()) {
+ session->request_locate (session->locations()->auto_loop_location()->start(), true);
+ } else {
+ session->request_transport_speed (1.0f);
+ }
}
}
diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
index b270993ab5..e57623cb9b 100644
--- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h
+++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h
@@ -102,7 +102,7 @@ class LIBCONTROLCP_API BasicUI {
void quick_snapshot_stay ();
void quick_snapshot_switch ();
- void toggle_roll(); //this provides the same operation as the "spacebar", it's a lot smarter than "play".
+ void toggle_roll(bool roll_out_of_bounded_mode=true); //this provides the same operation as the "spacebar", it's a lot smarter than "play".
void stop_forget();