summaryrefslogtreecommitdiff
path: root/libs/surfaces
diff options
context:
space:
mode:
authorLuciano Iam <lucianito@gmail.com>2020-04-18 12:39:18 +0200
committerRobin Gareus <robin@gareus.org>2020-04-20 22:59:15 +0200
commit0e664b1556b8f446cb950acbe59621bb591603c2 (patch)
tree18697c54123c864f8e247167c6865ba204a03ebb /libs/surfaces
parent656cd9c8a735e4c2bceae5ad5094ca2cea302539 (diff)
WebSockets: add transport roll support to surface
Diffstat (limited to 'libs/surfaces')
-rw-r--r--libs/surfaces/websockets/component.cc6
-rw-r--r--libs/surfaces/websockets/component.h3
-rw-r--r--libs/surfaces/websockets/dispatcher.cc1
-rw-r--r--libs/surfaces/websockets/feedback.cc23
-rw-r--r--libs/surfaces/websockets/globals.cc15
-rw-r--r--libs/surfaces/websockets/globals.h3
-rw-r--r--libs/surfaces/websockets/state.h2
7 files changed, 51 insertions, 2 deletions
diff --git a/libs/surfaces/websockets/component.cc b/libs/surfaces/websockets/component.cc
index 9294539697..13822f44c6 100644
--- a/libs/surfaces/websockets/component.cc
+++ b/libs/surfaces/websockets/component.cc
@@ -19,6 +19,12 @@
#include "component.h"
#include "ardour_websockets.h"
+BasicUI&
+SurfaceComponent::basic_ui () const
+{
+ return _surface;
+}
+
PBD::EventLoop*
SurfaceComponent::event_loop () const
{
diff --git a/libs/surfaces/websockets/component.h b/libs/surfaces/websockets/component.h
index 323e2d5d7b..b2edead1ce 100644
--- a/libs/surfaces/websockets/component.h
+++ b/libs/surfaces/websockets/component.h
@@ -19,6 +19,8 @@
#ifndef _ardour_surface_websockets_component_h_
#define _ardour_surface_websockets_component_h_
+#include "control_protocol/basic_ui.h"
+
#include <glibmm.h>
#include "ardour/session.h"
@@ -51,6 +53,7 @@ public:
return 0;
}
+ BasicUI& basic_ui () const;
PBD::EventLoop* event_loop () const;
Glib::RefPtr<Glib::MainLoop> main_loop () const;
ARDOUR::Session& session () const;
diff --git a/libs/surfaces/websockets/dispatcher.cc b/libs/surfaces/websockets/dispatcher.cc
index 718bfe9430..a70677cba5 100644
--- a/libs/surfaces/websockets/dispatcher.cc
+++ b/libs/surfaces/websockets/dispatcher.cc
@@ -53,6 +53,7 @@ WebsocketsDispatcher::dispatch (Client client, const NodeStateMessage& msg)
void
WebsocketsDispatcher::update_all_nodes (Client client)
{
+ update (client, Node::transport_roll, globals ().transport_roll ());
update (client, Node::tempo, globals ().tempo ());
for (uint32_t strip_n = 0; strip_n < strips ().strip_count (); ++strip_n) {
diff --git a/libs/surfaces/websockets/feedback.cc b/libs/surfaces/websockets/feedback.cc
index 6e956f8f61..d08238c989 100644
--- a/libs/surfaces/websockets/feedback.cc
+++ b/libs/surfaces/websockets/feedback.cc
@@ -29,6 +29,20 @@
using namespace ARDOUR;
+struct TransportObserver {
+ void operator() (ArdourFeedback* p)
+ {
+ p->update_all (Node::transport_roll, p->globals ().transport_roll ());
+ }
+};
+
+struct RecordStateObserver {
+ void operator() (ArdourFeedback* p)
+ {
+ // TO DO
+ }
+};
+
struct TempoObserver {
void operator() (ArdourFeedback* p)
{
@@ -162,8 +176,13 @@ ArdourFeedback::poll () const
void
ArdourFeedback::observe_globals ()
{
- session ().tempo_map ().PropertyChanged.connect (_signal_connections, MISSING_INVALIDATOR,
- boost::bind<void> (TempoObserver (), this), event_loop ());
+ ARDOUR::Session& sess = session ();
+ sess.TransportStateChange.connect (_signal_connections, MISSING_INVALIDATOR,
+ boost::bind<void> (TransportObserver (), this), event_loop ());
+ sess.RecordStateChanged.connect (_signal_connections, MISSING_INVALIDATOR,
+ boost::bind<void> (RecordStateObserver (), this), event_loop ());
+ sess.tempo_map ().PropertyChanged.connect (_signal_connections, MISSING_INVALIDATOR,
+ boost::bind<void> (TempoObserver (), this), event_loop ());
}
void
diff --git a/libs/surfaces/websockets/globals.cc b/libs/surfaces/websockets/globals.cc
index 4a78475350..0689f32df9 100644
--- a/libs/surfaces/websockets/globals.cc
+++ b/libs/surfaces/websockets/globals.cc
@@ -22,6 +22,21 @@
using namespace ARDOUR;
+bool
+ArdourGlobals::transport_roll () const
+{
+ return static_cast<bool>(basic_ui ().transport_rolling ());
+}
+
+void
+ArdourGlobals::set_transport_roll (bool value)
+{
+ if ((value && !transport_roll ()) || (!value && transport_roll ())) {
+ // this call is equivalent to hitting the spacebar
+ basic_ui ().toggle_roll ();
+ }
+}
+
double
ArdourGlobals::tempo () const
{
diff --git a/libs/surfaces/websockets/globals.h b/libs/surfaces/websockets/globals.h
index 88a3bd4004..dd6b8b14d1 100644
--- a/libs/surfaces/websockets/globals.h
+++ b/libs/surfaces/websockets/globals.h
@@ -28,6 +28,9 @@ public:
: SurfaceComponent (surface){};
virtual ~ArdourGlobals (){};
+ bool transport_roll () const;
+ void set_transport_roll (bool);
+
double tempo () const;
void set_tempo (double);
};
diff --git a/libs/surfaces/websockets/state.h b/libs/surfaces/websockets/state.h
index 39e7feced9..7bc7555f3d 100644
--- a/libs/surfaces/websockets/state.h
+++ b/libs/surfaces/websockets/state.h
@@ -32,6 +32,8 @@
namespace Node
{
const std::string tempo = "tempo";
+ const std::string transport_roll = "transport_roll";
+ const std::string record_state = "record_state";
const std::string strip_desc = "strip_desc";
const std::string strip_meter = "strip_meter";
const std::string strip_gain = "strip_gain";