summaryrefslogtreecommitdiff
path: root/libs/surfaces/websockets/feedback.cc
diff options
context:
space:
mode:
authorLuciano Iam <lucianito@gmail.com>2020-02-22 12:49:52 +0100
committerRobin Gareus <robin@gareus.org>2020-02-22 23:10:24 +0100
commitbb448080b6f980e669222cc67dbbc6db9e7fb1fd (patch)
treeb2258df3e9260d70aa1d7725df55f6ba8fc2ffe0 /libs/surfaces/websockets/feedback.cc
parentd8d70adab89a845da29fa6381bcda3ace341c7cb (diff)
Remove locally defined classes
Diffstat (limited to 'libs/surfaces/websockets/feedback.cc')
-rw-r--r--libs/surfaces/websockets/feedback.cc167
1 files changed, 82 insertions, 85 deletions
diff --git a/libs/surfaces/websockets/feedback.cc b/libs/surfaces/websockets/feedback.cc
index 97d97dce6e..cf094ddbff 100644
--- a/libs/surfaces/websockets/feedback.cc
+++ b/libs/surfaces/websockets/feedback.cc
@@ -31,7 +31,45 @@ using namespace ARDOUR;
#define ADDR_NONE UINT_MAX
-typedef boost::function<void ()> SignalObserver;
+struct TempoObserver {
+ void operator() (ArdourFeedback* p) {
+ p->update_all (Node::tempo, p->globals ().tempo ());
+ }
+};
+
+struct StripGainObserver {
+ void operator() (ArdourFeedback* p, uint32_t strip_n) {
+ // fires multiple times (4x as of ardour 6.0)
+ p->update_all (Node::strip_gain, strip_n, p->strips ().strip_gain (strip_n));
+ }
+};
+
+struct StripPanObserver {
+ void operator() (ArdourFeedback* p, uint32_t strip_n) {
+ p->update_all (Node::strip_pan, strip_n, p->strips ().strip_pan (strip_n));
+ }
+};
+
+struct StripMuteObserver {
+ void operator() (ArdourFeedback* p, uint32_t strip_n) {
+ p->update_all (Node::strip_mute, strip_n, p->strips ().strip_mute (strip_n));
+ }
+};
+
+struct PluginBypassObserver {
+ void operator() (ArdourFeedback* p, uint32_t strip_n, uint32_t plugin_n) {
+ p->update_all (Node::strip_plugin_enable, strip_n, plugin_n,
+ p->strips ().strip_plugin_enabled (strip_n, plugin_n));
+ }
+};
+
+struct PluginParamValueObserver {
+ void operator() (ArdourFeedback* p, uint32_t strip_n, uint32_t plugin_n,
+ uint32_t param_n, boost::shared_ptr<AutomationControl> control) {
+ p->update_all (Node::strip_plugin_param_value, strip_n, plugin_n, param_n,
+ ArdourStrips::plugin_param_value (control));
+ }
+};
int
ArdourFeedback::start ()
@@ -56,6 +94,49 @@ ArdourFeedback::stop ()
return 0;
}
+void
+ArdourFeedback::update_all (std::string node, TypedValue value) const
+{
+ update_all (node, ADDR_NONE, ADDR_NONE, ADDR_NONE, value);
+}
+
+void
+ArdourFeedback::update_all (std::string node, uint32_t strip_n, TypedValue value) const
+{
+ update_all (node, strip_n, ADDR_NONE, ADDR_NONE, value);
+}
+
+void
+ArdourFeedback::update_all (std::string node, uint32_t strip_n, uint32_t plugin_n,
+ TypedValue value) const
+{
+ update_all (node, strip_n, plugin_n, ADDR_NONE, value);
+}
+
+void
+ArdourFeedback::update_all (std::string node, uint32_t strip_n, uint32_t plugin_n, uint32_t param_n,
+ TypedValue value) const
+{
+ AddressVector addr = AddressVector ();
+
+ if (strip_n != ADDR_NONE) {
+ addr.push_back (strip_n);
+ }
+
+ if (plugin_n != ADDR_NONE) {
+ addr.push_back (plugin_n);
+ }
+
+ if (param_n != ADDR_NONE) {
+ addr.push_back (param_n);
+ }
+
+ ValueVector val = ValueVector ();
+ val.push_back (value);
+
+ server ().update_all_clients (NodeState (node, addr, val), false);
+}
+
bool
ArdourFeedback::poll () const
{
@@ -73,13 +154,6 @@ ArdourFeedback::poll () const
void
ArdourFeedback::observe_globals ()
{
- // tempo
- struct TempoObserver {
- void operator() (ArdourFeedback* p) {
- p->update_all (Node::tempo, p->globals ().tempo ());
- }
- };
-
session ().tempo_map ().PropertyChanged.connect (_signal_connections, MISSING_INVALIDATOR,
boost::bind<void> (TempoObserver (), this), event_loop ());
}
@@ -90,28 +164,12 @@ ArdourFeedback::observe_strips ()
for (uint32_t strip_n = 0; strip_n < strips ().strip_count (); ++strip_n) {
boost::shared_ptr<Stripable> strip = strips ().nth_strip (strip_n);
- struct StripGainObserver {
- void operator() (ArdourFeedback* p, uint32_t strip_n) {
- // fires multiple times (4x as of ardour 6.0)
- p->update_all (Node::strip_gain, strip_n, p->strips ().strip_gain (strip_n));
- }
- };
strip->gain_control ()->Changed.connect (_signal_connections, MISSING_INVALIDATOR,
boost::bind<void> (StripGainObserver (), this, strip_n), event_loop ());
- struct StripPanObserver {
- void operator() (ArdourFeedback* p, uint32_t strip_n) {
- p->update_all (Node::strip_pan, strip_n, p->strips ().strip_pan (strip_n));
- }
- };
strip->pan_azimuth_control ()->Changed.connect (_signal_connections, MISSING_INVALIDATOR,
boost::bind<void> (StripPanObserver (), this, strip_n), event_loop ());
- struct StripMuteObserver {
- void operator() (ArdourFeedback* p, uint32_t strip_n) {
- p->update_all (Node::strip_mute, strip_n, p->strips ().strip_mute (strip_n));
- }
- };
strip->mute_control ()->Changed.connect (_signal_connections, MISSING_INVALIDATOR,
boost::bind<void> (StripMuteObserver (), this, strip_n), event_loop ());
@@ -133,13 +191,6 @@ ArdourFeedback::observe_strip_plugins (uint32_t strip_n, boost::shared_ptr<ARDOU
boost::shared_ptr<AutomationControl> control = insert->automation_control (param);
if (control) {
- struct PluginBypassObserver {
- void operator() (ArdourFeedback* p, uint32_t strip_n, uint32_t plugin_n) {
- p->update_all (Node::strip_plugin_enable, strip_n, plugin_n,
- p->strips ().strip_plugin_enabled (strip_n, plugin_n));
- }
- };
-
control->Changed.connect (_signal_connections, MISSING_INVALIDATOR,
boost::bind<void> (PluginBypassObserver (), this, strip_n, plugin_n), event_loop ());
}
@@ -162,62 +213,8 @@ ArdourFeedback::observe_strip_plugin_param_values (uint32_t strip_n,
continue;
}
- struct PluginParamValueObserver {
- void operator() (ArdourFeedback* p, uint32_t strip_n, uint32_t plugin_n,
- uint32_t param_n, boost::shared_ptr<AutomationControl> control) {
- p->update_all (
- Node::strip_plugin_param_value,
- strip_n, plugin_n, param_n,
- ArdourStrips::plugin_param_value (control)
- );
- }
- };
-
control->Changed.connect (_signal_connections, MISSING_INVALIDATOR,
boost::bind<void> (PluginParamValueObserver (), this, strip_n, plugin_n, param_n,
control), event_loop ());
}
}
-
-void
-ArdourFeedback::update_all (std::string node, TypedValue value) const
-{
- update_all (node, ADDR_NONE, ADDR_NONE, ADDR_NONE, value);
-}
-
-void
-ArdourFeedback::update_all (std::string node, uint32_t strip_n, TypedValue value) const
-{
- update_all (node, strip_n, ADDR_NONE, ADDR_NONE, value);
-}
-
-void
-ArdourFeedback::update_all (std::string node, uint32_t strip_n, uint32_t plugin_n,
- TypedValue value) const
-{
- update_all (node, strip_n, plugin_n, ADDR_NONE, value);
-}
-
-void
-ArdourFeedback::update_all (std::string node, uint32_t strip_n, uint32_t plugin_n, uint32_t param_n,
- TypedValue value) const
-{
- AddressVector addr = AddressVector ();
-
- if (strip_n != ADDR_NONE) {
- addr.push_back (strip_n);
- }
-
- if (plugin_n != ADDR_NONE) {
- addr.push_back (plugin_n);
- }
-
- if (param_n != ADDR_NONE) {
- addr.push_back (param_n);
- }
-
- ValueVector val = ValueVector ();
- val.push_back (value);
-
- server ().update_all_clients (NodeState (node, addr, val), false);
-}