13
0

OSC toggle roll make return to zero optional

This commit is contained in:
Len Ovens 2020-08-20 16:25:08 -07:00
parent b8da1d0265
commit 1cc9573dba
2 changed files with 34 additions and 6 deletions

View File

@ -494,8 +494,6 @@ OSC::register_callbacks()
REGISTER_CALLBACK (serv, X_("/click/level"), "f", click_level); REGISTER_CALLBACK (serv, X_("/click/level"), "f", click_level);
REGISTER_CALLBACK (serv, X_("/midi_panic"), "", midi_panic); REGISTER_CALLBACK (serv, X_("/midi_panic"), "", midi_panic);
REGISTER_CALLBACK (serv, X_("/midi_panic"), "f", midi_panic); REGISTER_CALLBACK (serv, X_("/midi_panic"), "f", midi_panic);
REGISTER_CALLBACK (serv, X_("/toggle_roll"), "", osc_toggle_roll);
REGISTER_CALLBACK (serv, X_("/toggle_roll"), "f", osc_toggle_roll);
REGISTER_CALLBACK (serv, X_("/stop_forget"), "", stop_forget); REGISTER_CALLBACK (serv, X_("/stop_forget"), "", stop_forget);
REGISTER_CALLBACK (serv, X_("/stop_forget"), "f", stop_forget); REGISTER_CALLBACK (serv, X_("/stop_forget"), "f", stop_forget);
REGISTER_CALLBACK (serv, X_("/set_punch_range"), "", set_punch_range); REGISTER_CALLBACK (serv, X_("/set_punch_range"), "", set_punch_range);
@ -844,6 +842,17 @@ OSC::catchall (const char *path, const char* types, lo_arg **argv, int argc, lo_
ret = touch_detect (path, types, argv, argc, msg); ret = touch_detect (path, types, argv, argc, msg);
} else } else
if (strstr (path, X_("/toggle_roll"))) {
if (!argc) {
ret = osc_toggle_roll (false);
} else {
if ((types[0] == 'f' && argv[0]->f == 1.0) || (types[0] == 'i' && argv[0]->i == 1)) {
ret = osc_toggle_roll (true);
} else if ((types[0] == 'f' && argv[0]->f == 0.0) || (types[0] == 'i' && argv[0]->i == 0)) {
ret = osc_toggle_roll (false);
}
}
} else
if (strstr (path, X_("/spill"))) { if (strstr (path, X_("/spill"))) {
ret = spill (path, types, argv, argc, msg); ret = spill (path, types, argv, argc, msg);
@ -1451,9 +1460,29 @@ OSC::cancel_all_solos ()
} }
int int
OSC::osc_toggle_roll () OSC::osc_toggle_roll (bool ret2strt)
{ {
toggle_roll (false); if (!session) {
return 0;
}
if (session->is_auditioning()) {
session->cancel_audition ();
return 0;
}
bool rolling = transport_rolling();
if (rolling) {
session->request_stop (ret2strt, true);
} else {
if (session->get_play_loop() && Config->get_loop_is_mode()) {
session->request_locate (session->locations()->auto_loop_location()->start(), MustRoll);
} else {
session->request_transport_speed (1.0f);
}
}
return 0; return 0;
} }

View File

@ -438,7 +438,6 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
PATH_CALLBACK(mark_out); PATH_CALLBACK(mark_out);
PATH_CALLBACK(toggle_click); PATH_CALLBACK(toggle_click);
PATH_CALLBACK(midi_panic); PATH_CALLBACK(midi_panic);
PATH_CALLBACK(osc_toggle_roll);
PATH_CALLBACK(stop_forget); PATH_CALLBACK(stop_forget);
PATH_CALLBACK(set_punch_range); PATH_CALLBACK(set_punch_range);
PATH_CALLBACK(set_loop_range); PATH_CALLBACK(set_loop_range);
@ -822,7 +821,7 @@ class OSC : public ARDOUR::ControlProtocol, public AbstractUI<OSCUIRequest>
void notify_vca_added (ARDOUR::VCAList &); void notify_vca_added (ARDOUR::VCAList &);
int cancel_all_solos (); int cancel_all_solos ();
int osc_toggle_roll (); int osc_toggle_roll (bool ret2strt);
bool periodic (void); bool periodic (void);
sigc::connection periodic_connection; sigc::connection periodic_connection;
PBD::ScopedConnectionList session_connections; PBD::ScopedConnectionList session_connections;