From a8cc5b13031f7116cede2495db2a6f632bd0b81d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 29 Dec 2019 18:42:34 -0700 Subject: [PATCH] provide new methods for BasicUI that wrap the "complexity" of how to show transport state via lit buttons --- libs/surfaces/control_protocol/basic_ui.cc | 32 ++++++++++++++++++- .../control_protocol/basic_ui.h | 6 ++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/libs/surfaces/control_protocol/basic_ui.cc b/libs/surfaces/control_protocol/basic_ui.cc index 2f0e4732e8..65ea59197a 100644 --- a/libs/surfaces/control_protocol/basic_ui.cc +++ b/libs/surfaces/control_protocol/basic_ui.cc @@ -188,7 +188,7 @@ BasicUI::remove_marker_at_playhead () void BasicUI::rewind () { - session->request_transport_speed (session->transport_speed() - 1.5); + session->request_transport_speed (session->actual_speed() - 1.5); } void @@ -203,6 +203,36 @@ BasicUI::transport_stop () session->request_transport_speed (0.0); } +bool +BasicUI::stop_button_onoff () const +{ + return session->transport_stopped_or_stopping (); +} + +bool +BasicUI::play_button_onoff () const +{ + return session->actual_speed() == 1.0; +} + +bool +BasicUI::ffwd_button_onoff () const +{ + return session->actual_speed() > 1.0; +} + +bool +BasicUI::rewind_button_onoff () const +{ + return session->actual_speed() < 0.0; +} + +bool +BasicUI::loop_button_onoff () const +{ + return session->get_play_loop(); +} + void BasicUI::transport_play (bool from_last_start) { diff --git a/libs/surfaces/control_protocol/control_protocol/basic_ui.h b/libs/surfaces/control_protocol/control_protocol/basic_ui.h index e57623cb9b..af1e127b03 100644 --- a/libs/surfaces/control_protocol/control_protocol/basic_ui.h +++ b/libs/surfaces/control_protocol/control_protocol/basic_ui.h @@ -151,6 +151,12 @@ class LIBCONTROLCP_API BasicUI { void timecode_to_sample (Timecode::Time& timecode, samplepos_t & sample, bool use_offset, bool use_subframes) const; void sample_to_timecode (samplepos_t sample, Timecode::Time& timecode, bool use_offset, bool use_subframes) const; + bool stop_button_onoff() const; + bool play_button_onoff() const; + bool ffwd_button_onoff() const; + bool rewind_button_onoff() const; + bool loop_button_onoff() const; + protected: BasicUI (); ARDOUR::Session* session;