mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 18:46:34 +01:00
WebSockets: code refactor
Terminology used by server and client was starting to diverge. C++ classes ArdourStrips and ArdourGlobals classes have been renamed to ArdourMixer and ArdourTransport respectively. State node values for transport functionality have been simplified and prefixed with 'transport_' to match what was done for strips.
This commit is contained in:
parent
ae4df127ad
commit
a26a9018fd
17 changed files with 147 additions and 165 deletions
|
|
@ -37,14 +37,14 @@ using namespace ArdourSurface;
|
||||||
ArdourWebsockets::ArdourWebsockets (Session& s)
|
ArdourWebsockets::ArdourWebsockets (Session& s)
|
||||||
: ControlProtocol (s, X_ (surface_name))
|
: ControlProtocol (s, X_ (surface_name))
|
||||||
, AbstractUI<ArdourWebsocketsUIRequest> (name ())
|
, AbstractUI<ArdourWebsocketsUIRequest> (name ())
|
||||||
, _strips (*this)
|
, _mixer (*this)
|
||||||
, _globals (*this)
|
, _transport (*this)
|
||||||
, _feedback (*this)
|
, _feedback (*this)
|
||||||
, _server (*this)
|
, _server (*this)
|
||||||
, _dispatcher (*this)
|
, _dispatcher (*this)
|
||||||
{
|
{
|
||||||
_components.push_back (&_strips);
|
_components.push_back (&_mixer);
|
||||||
_components.push_back (&_globals);
|
_components.push_back (&_transport);
|
||||||
_components.push_back (&_server);
|
_components.push_back (&_server);
|
||||||
_components.push_back (&_feedback);
|
_components.push_back (&_feedback);
|
||||||
_components.push_back (&_dispatcher);
|
_components.push_back (&_dispatcher);
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
#include "dispatcher.h"
|
#include "dispatcher.h"
|
||||||
#include "feedback.h"
|
#include "feedback.h"
|
||||||
#include "globals.h"
|
#include "transport.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "strips.h"
|
#include "mixer.h"
|
||||||
|
|
||||||
namespace ArdourSurface
|
namespace ArdourSurface
|
||||||
{
|
{
|
||||||
|
|
@ -65,13 +65,13 @@ public:
|
||||||
{
|
{
|
||||||
return *session;
|
return *session;
|
||||||
}
|
}
|
||||||
ArdourStrips& strips_component ()
|
ArdourMixer& mixer_component ()
|
||||||
{
|
{
|
||||||
return _strips;
|
return _mixer;
|
||||||
}
|
}
|
||||||
ArdourGlobals& globals_component ()
|
ArdourTransport& transport_component ()
|
||||||
{
|
{
|
||||||
return _globals;
|
return _transport;
|
||||||
}
|
}
|
||||||
WebsocketsServer& server_component ()
|
WebsocketsServer& server_component ()
|
||||||
{
|
{
|
||||||
|
|
@ -93,8 +93,8 @@ protected:
|
||||||
void do_request (ArdourWebsocketsUIRequest*);
|
void do_request (ArdourWebsocketsUIRequest*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ArdourStrips _strips;
|
ArdourMixer _mixer;
|
||||||
ArdourGlobals _globals;
|
ArdourTransport _transport;
|
||||||
ArdourFeedback _feedback;
|
ArdourFeedback _feedback;
|
||||||
WebsocketsServer _server;
|
WebsocketsServer _server;
|
||||||
WebsocketsDispatcher _dispatcher;
|
WebsocketsDispatcher _dispatcher;
|
||||||
|
|
|
||||||
|
|
@ -43,16 +43,16 @@ SurfaceComponent::session () const
|
||||||
return _surface.ardour_session ();
|
return _surface.ardour_session ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArdourStrips&
|
ArdourMixer&
|
||||||
SurfaceComponent::strips () const
|
SurfaceComponent::mixer () const
|
||||||
{
|
{
|
||||||
return _surface.strips_component ();
|
return _surface.mixer_component ();
|
||||||
}
|
}
|
||||||
|
|
||||||
ArdourGlobals&
|
ArdourTransport&
|
||||||
SurfaceComponent::globals () const
|
SurfaceComponent::transport () const
|
||||||
{
|
{
|
||||||
return _surface.globals_component ();
|
return _surface.transport_component ();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebsocketsServer&
|
WebsocketsServer&
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,8 @@ namespace ArdourSurface
|
||||||
class ArdourWebsockets;
|
class ArdourWebsockets;
|
||||||
}
|
}
|
||||||
|
|
||||||
class ArdourStrips;
|
class ArdourMixer;
|
||||||
class ArdourGlobals;
|
class ArdourTransport;
|
||||||
class WebsocketsServer;
|
class WebsocketsServer;
|
||||||
class WebsocketsDispatcher;
|
class WebsocketsDispatcher;
|
||||||
|
|
||||||
|
|
@ -57,8 +57,8 @@ public:
|
||||||
PBD::EventLoop* event_loop () const;
|
PBD::EventLoop* event_loop () const;
|
||||||
Glib::RefPtr<Glib::MainLoop> main_loop () const;
|
Glib::RefPtr<Glib::MainLoop> main_loop () const;
|
||||||
ARDOUR::Session& session () const;
|
ARDOUR::Session& session () const;
|
||||||
ArdourStrips& strips () const;
|
ArdourMixer& mixer () const;
|
||||||
ArdourGlobals& globals () const;
|
ArdourTransport& transport () const;
|
||||||
WebsocketsServer& server () const;
|
WebsocketsServer& server () const;
|
||||||
WebsocketsDispatcher& dispatcher () const;
|
WebsocketsDispatcher& dispatcher () const;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,9 @@ using namespace ARDOUR;
|
||||||
|
|
||||||
WebsocketsDispatcher::NodeMethodMap
|
WebsocketsDispatcher::NodeMethodMap
|
||||||
WebsocketsDispatcher::_node_to_method = boost::assign::map_list_of
|
WebsocketsDispatcher::_node_to_method = boost::assign::map_list_of
|
||||||
NODE_METHOD_PAIR (tempo)
|
NODE_METHOD_PAIR (transport_tempo)
|
||||||
NODE_METHOD_PAIR (transport_roll)
|
NODE_METHOD_PAIR (transport_roll)
|
||||||
NODE_METHOD_PAIR (record_state)
|
NODE_METHOD_PAIR (transport_record)
|
||||||
NODE_METHOD_PAIR (strip_gain)
|
NODE_METHOD_PAIR (strip_gain)
|
||||||
NODE_METHOD_PAIR (strip_pan)
|
NODE_METHOD_PAIR (strip_pan)
|
||||||
NODE_METHOD_PAIR (strip_mute)
|
NODE_METHOD_PAIR (strip_mute)
|
||||||
|
|
@ -55,8 +55,8 @@ WebsocketsDispatcher::dispatch (Client client, const NodeStateMessage& msg)
|
||||||
void
|
void
|
||||||
WebsocketsDispatcher::update_all_nodes (Client client)
|
WebsocketsDispatcher::update_all_nodes (Client client)
|
||||||
{
|
{
|
||||||
for (uint32_t strip_n = 0; strip_n < strips ().strip_count (); ++strip_n) {
|
for (uint32_t strip_n = 0; strip_n < mixer ().strip_count (); ++strip_n) {
|
||||||
boost::shared_ptr<Stripable> strip = strips ().nth_strip (strip_n);
|
boost::shared_ptr<Stripable> strip = mixer ().nth_strip (strip_n);
|
||||||
|
|
||||||
bool is_vca = strip->presentation_info ().flags () & ARDOUR::PresentationInfo::VCA;
|
bool is_vca = strip->presentation_info ().flags () & ARDOUR::PresentationInfo::VCA;
|
||||||
|
|
||||||
|
|
@ -68,8 +68,8 @@ WebsocketsDispatcher::update_all_nodes (Client client)
|
||||||
|
|
||||||
update (client, Node::strip_description, strip_addr, strip_desc);
|
update (client, Node::strip_description, strip_addr, strip_desc);
|
||||||
|
|
||||||
update (client, Node::strip_gain, strip_n, strips ().strip_gain (strip_n));
|
update (client, Node::strip_gain, strip_n, mixer ().strip_gain (strip_n));
|
||||||
update (client, Node::strip_mute, strip_n, strips ().strip_mute (strip_n));
|
update (client, Node::strip_mute, strip_n, mixer ().strip_mute (strip_n));
|
||||||
|
|
||||||
// Pan and plugins not available in VCAs
|
// Pan and plugins not available in VCAs
|
||||||
if (is_vca) {
|
if (is_vca) {
|
||||||
|
|
@ -81,10 +81,10 @@ WebsocketsDispatcher::update_all_nodes (Client client)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
update (client, Node::strip_pan, strip_n, strips ().strip_pan (strip_n));
|
update (client, Node::strip_pan, strip_n, mixer ().strip_pan (strip_n));
|
||||||
|
|
||||||
for (uint32_t plugin_n = 0;; ++plugin_n) {
|
for (uint32_t plugin_n = 0;; ++plugin_n) {
|
||||||
boost::shared_ptr<PluginInsert> insert = strips ()
|
boost::shared_ptr<PluginInsert> insert = mixer ()
|
||||||
.strip_plugin_insert (strip_n, plugin_n);
|
.strip_plugin_insert (strip_n, plugin_n);
|
||||||
if (!insert) {
|
if (!insert) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -95,11 +95,11 @@ WebsocketsDispatcher::update_all_nodes (Client client)
|
||||||
static_cast<std::string> (plugin->name ()));
|
static_cast<std::string> (plugin->name ()));
|
||||||
|
|
||||||
update (client, Node::strip_plugin_enable, strip_n, plugin_n,
|
update (client, Node::strip_plugin_enable, strip_n, plugin_n,
|
||||||
strips ().strip_plugin_enabled (strip_n, plugin_n));
|
mixer ().strip_plugin_enabled (strip_n, plugin_n));
|
||||||
|
|
||||||
for (uint32_t param_n = 0; param_n < plugin->parameter_count (); ++param_n) {
|
for (uint32_t param_n = 0; param_n < plugin->parameter_count (); ++param_n) {
|
||||||
boost::shared_ptr<AutomationControl> a_ctrl =
|
boost::shared_ptr<AutomationControl> a_ctrl =
|
||||||
strips ().strip_plugin_param_control (strip_n, plugin_n, param_n);
|
mixer ().strip_plugin_param_control (strip_n, plugin_n, param_n);
|
||||||
if (!a_ctrl) {
|
if (!a_ctrl) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -130,27 +130,27 @@ WebsocketsDispatcher::update_all_nodes (Client client)
|
||||||
|
|
||||||
update (client, Node::strip_plugin_param_description, addr, val);
|
update (client, Node::strip_plugin_param_description, addr, val);
|
||||||
|
|
||||||
TypedValue value = strips ().strip_plugin_param_value (strip_n, plugin_n, param_n);
|
TypedValue value = mixer ().strip_plugin_param_value (strip_n, plugin_n, param_n);
|
||||||
update (client, Node::strip_plugin_param_value, strip_n, plugin_n, param_n, value);
|
update (client, Node::strip_plugin_param_value, strip_n, plugin_n, param_n, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update (client, Node::tempo, globals ().tempo ());
|
update (client, Node::transport_tempo, transport ().tempo ());
|
||||||
update (client, Node::position_time, globals ().position_time ());
|
update (client, Node::transport_time, transport ().time ());
|
||||||
update (client, Node::transport_roll, globals ().transport_roll ());
|
update (client, Node::transport_roll, transport ().roll ());
|
||||||
update (client, Node::record_state, globals ().record_state ());
|
update (client, Node::transport_record, transport ().record ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WebsocketsDispatcher::tempo_handler (Client client, const NodeStateMessage& msg)
|
WebsocketsDispatcher::transport_tempo_handler (Client client, const NodeStateMessage& msg)
|
||||||
{
|
{
|
||||||
const NodeState& state = msg.state ();
|
const NodeState& state = msg.state ();
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
globals ().set_tempo (state.nth_val (0));
|
transport ().set_tempo (state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
update (client, Node::tempo, globals ().tempo ());
|
update (client, Node::transport_tempo, transport ().tempo ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -160,21 +160,21 @@ WebsocketsDispatcher::transport_roll_handler (Client client, const NodeStateMess
|
||||||
const NodeState& state = msg.state ();
|
const NodeState& state = msg.state ();
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
globals ().set_transport_roll (state.nth_val (0));
|
transport ().set_roll (state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
update (client, Node::transport_roll, globals ().transport_roll ());
|
update (client, Node::transport_roll, transport ().roll ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
WebsocketsDispatcher::record_state_handler (Client client, const NodeStateMessage& msg)
|
WebsocketsDispatcher::transport_record_handler (Client client, const NodeStateMessage& msg)
|
||||||
{
|
{
|
||||||
const NodeState& state = msg.state ();
|
const NodeState& state = msg.state ();
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
globals ().set_record_state (state.nth_val (0));
|
transport ().set_record (state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
update (client, Node::record_state, globals ().record_state ());
|
update (client, Node::transport_record, transport ().record ());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -190,9 +190,9 @@ WebsocketsDispatcher::strip_gain_handler (Client client, const NodeStateMessage&
|
||||||
uint32_t strip_id = state.nth_addr (0);
|
uint32_t strip_id = state.nth_addr (0);
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
strips ().set_strip_gain (strip_id, state.nth_val (0));
|
mixer ().set_strip_gain (strip_id, state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
update (client, Node::strip_gain, strip_id, strips ().strip_gain (strip_id));
|
update (client, Node::strip_gain, strip_id, mixer ().strip_gain (strip_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -208,9 +208,9 @@ WebsocketsDispatcher::strip_pan_handler (Client client, const NodeStateMessage&
|
||||||
uint32_t strip_id = state.nth_addr (0);
|
uint32_t strip_id = state.nth_addr (0);
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
strips ().set_strip_pan (strip_id, state.nth_val (0));
|
mixer ().set_strip_pan (strip_id, state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
update (client, Node::strip_pan, strip_id, strips ().strip_pan (strip_id));
|
update (client, Node::strip_pan, strip_id, mixer ().strip_pan (strip_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -226,9 +226,9 @@ WebsocketsDispatcher::strip_mute_handler (Client client, const NodeStateMessage&
|
||||||
uint32_t strip_id = state.nth_addr (0);
|
uint32_t strip_id = state.nth_addr (0);
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
strips ().set_strip_mute (strip_id, state.nth_val (0));
|
mixer ().set_strip_mute (strip_id, state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
update (client, Node::strip_mute, strip_id, strips ().strip_mute (strip_id));
|
update (client, Node::strip_mute, strip_id, mixer ().strip_mute (strip_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -245,10 +245,10 @@ WebsocketsDispatcher::strip_plugin_enable_handler (Client client, const NodeStat
|
||||||
uint32_t plugin_id = state.nth_addr (1);
|
uint32_t plugin_id = state.nth_addr (1);
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
strips ().set_strip_plugin_enabled (strip_id, plugin_id, state.nth_val (0));
|
mixer ().set_strip_plugin_enabled (strip_id, plugin_id, state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
update (client, Node::strip_plugin_enable, strip_id, plugin_id,
|
update (client, Node::strip_plugin_enable, strip_id, plugin_id,
|
||||||
strips ().strip_plugin_enabled (strip_id, plugin_id));
|
mixer ().strip_plugin_enabled (strip_id, plugin_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -266,10 +266,10 @@ WebsocketsDispatcher::strip_plugin_param_value_handler (Client client, const Nod
|
||||||
uint32_t param_id = state.nth_addr (2);
|
uint32_t param_id = state.nth_addr (2);
|
||||||
|
|
||||||
if (msg.is_write () && (state.n_val () > 0)) {
|
if (msg.is_write () && (state.n_val () > 0)) {
|
||||||
strips ().set_strip_plugin_param_value (strip_id, plugin_id, param_id,
|
mixer ().set_strip_plugin_param_value (strip_id, plugin_id, param_id,
|
||||||
state.nth_val (0));
|
state.nth_val (0));
|
||||||
} else {
|
} else {
|
||||||
TypedValue value = strips ().strip_plugin_param_value (strip_id, plugin_id, param_id);
|
TypedValue value = mixer ().strip_plugin_param_value (strip_id, plugin_id, param_id);
|
||||||
update (client, Node::strip_plugin_param_value, strip_id, plugin_id, param_id, value);
|
update (client, Node::strip_plugin_param_value, strip_id, plugin_id, param_id, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,9 +41,9 @@ private:
|
||||||
|
|
||||||
static NodeMethodMap _node_to_method;
|
static NodeMethodMap _node_to_method;
|
||||||
|
|
||||||
void tempo_handler (Client, const NodeStateMessage&);
|
void transport_tempo_handler (Client, const NodeStateMessage&);
|
||||||
void transport_roll_handler (Client client, const NodeStateMessage&);
|
void transport_roll_handler (Client client, const NodeStateMessage&);
|
||||||
void record_state_handler (Client client, const NodeStateMessage&);
|
void transport_record_handler (Client client, const NodeStateMessage&);
|
||||||
void strip_gain_handler (Client, const NodeStateMessage&);
|
void strip_gain_handler (Client, const NodeStateMessage&);
|
||||||
void strip_pan_handler (Client, const NodeStateMessage&);
|
void strip_pan_handler (Client, const NodeStateMessage&);
|
||||||
void strip_mute_handler (Client, const NodeStateMessage&);
|
void strip_mute_handler (Client, const NodeStateMessage&);
|
||||||
|
|
|
||||||
|
|
@ -22,10 +22,10 @@
|
||||||
#include "ardour/tempo.h"
|
#include "ardour/tempo.h"
|
||||||
|
|
||||||
#include "feedback.h"
|
#include "feedback.h"
|
||||||
#include "globals.h"
|
#include "transport.h"
|
||||||
#include "server.h"
|
#include "server.h"
|
||||||
#include "state.h"
|
#include "state.h"
|
||||||
#include "strips.h"
|
#include "mixer.h"
|
||||||
|
|
||||||
// TO DO: make this configurable
|
// TO DO: make this configurable
|
||||||
#define POLL_INTERVAL_MS 100
|
#define POLL_INTERVAL_MS 100
|
||||||
|
|
@ -35,21 +35,21 @@ using namespace ARDOUR;
|
||||||
struct TransportObserver {
|
struct TransportObserver {
|
||||||
void operator() (ArdourFeedback* p)
|
void operator() (ArdourFeedback* p)
|
||||||
{
|
{
|
||||||
p->update_all (Node::transport_roll, p->globals ().transport_roll ());
|
p->update_all (Node::transport_roll, p->transport ().roll ());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct RecordStateObserver {
|
struct RecordStateObserver {
|
||||||
void operator() (ArdourFeedback* p)
|
void operator() (ArdourFeedback* p)
|
||||||
{
|
{
|
||||||
p->update_all (Node::record_state, p->globals ().record_state ());
|
p->update_all (Node::transport_record, p->transport ().record ());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TempoObserver {
|
struct TempoObserver {
|
||||||
void operator() (ArdourFeedback* p)
|
void operator() (ArdourFeedback* p)
|
||||||
{
|
{
|
||||||
p->update_all (Node::tempo, p->globals ().tempo ());
|
p->update_all (Node::transport_tempo, p->transport ().tempo ());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -57,21 +57,21 @@ struct StripGainObserver {
|
||||||
void operator() (ArdourFeedback* p, uint32_t strip_n)
|
void operator() (ArdourFeedback* p, uint32_t strip_n)
|
||||||
{
|
{
|
||||||
// fires multiple times (4x as of ardour 6.0)
|
// fires multiple times (4x as of ardour 6.0)
|
||||||
p->update_all (Node::strip_gain, strip_n, p->strips ().strip_gain (strip_n));
|
p->update_all (Node::strip_gain, strip_n, p->mixer ().strip_gain (strip_n));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StripPanObserver {
|
struct StripPanObserver {
|
||||||
void operator() (ArdourFeedback* p, uint32_t strip_n)
|
void operator() (ArdourFeedback* p, uint32_t strip_n)
|
||||||
{
|
{
|
||||||
p->update_all (Node::strip_pan, strip_n, p->strips ().strip_pan (strip_n));
|
p->update_all (Node::strip_pan, strip_n, p->mixer ().strip_pan (strip_n));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct StripMuteObserver {
|
struct StripMuteObserver {
|
||||||
void operator() (ArdourFeedback* p, uint32_t strip_n)
|
void operator() (ArdourFeedback* p, uint32_t strip_n)
|
||||||
{
|
{
|
||||||
p->update_all (Node::strip_mute, strip_n, p->strips ().strip_mute (strip_n));
|
p->update_all (Node::strip_mute, strip_n, p->mixer ().strip_mute (strip_n));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -79,7 +79,7 @@ struct PluginBypassObserver {
|
||||||
void operator() (ArdourFeedback* p, uint32_t strip_n, uint32_t plugin_n)
|
void operator() (ArdourFeedback* p, uint32_t strip_n, uint32_t plugin_n)
|
||||||
{
|
{
|
||||||
p->update_all (Node::strip_plugin_enable, strip_n, plugin_n,
|
p->update_all (Node::strip_plugin_enable, strip_n, plugin_n,
|
||||||
p->strips ().strip_plugin_enabled (strip_n, plugin_n));
|
p->mixer ().strip_plugin_enabled (strip_n, plugin_n));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -92,15 +92,15 @@ struct PluginParamValueObserver {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p->update_all (Node::strip_plugin_param_value, strip_n, plugin_n, param_n,
|
p->update_all (Node::strip_plugin_param_value, strip_n, plugin_n, param_n,
|
||||||
ArdourStrips::plugin_param_value (control));
|
ArdourMixer::plugin_param_value (control));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
int
|
||||||
ArdourFeedback::start ()
|
ArdourFeedback::start ()
|
||||||
{
|
{
|
||||||
observe_globals ();
|
observe_transport ();
|
||||||
observe_strips ();
|
observe_mixer ();
|
||||||
|
|
||||||
// some things need polling like the strip meters
|
// some things need polling like the strip meters
|
||||||
Glib::RefPtr<Glib::TimeoutSource> periodic_timeout = Glib::TimeoutSource::create (POLL_INTERVAL_MS);
|
Glib::RefPtr<Glib::TimeoutSource> periodic_timeout = Glib::TimeoutSource::create (POLL_INTERVAL_MS);
|
||||||
|
|
@ -165,11 +165,11 @@ ArdourFeedback::update_all (std::string node, uint32_t strip_n, uint32_t plugin_
|
||||||
bool
|
bool
|
||||||
ArdourFeedback::poll () const
|
ArdourFeedback::poll () const
|
||||||
{
|
{
|
||||||
update_all (Node::position_time, globals ().position_time ());
|
update_all (Node::transport_time, transport ().time ());
|
||||||
|
|
||||||
for (uint32_t strip_n = 0; strip_n < strips ().strip_count (); ++strip_n) {
|
for (uint32_t strip_n = 0; strip_n < mixer ().strip_count (); ++strip_n) {
|
||||||
// meters
|
// meters
|
||||||
boost::shared_ptr<Stripable> strip = strips ().nth_strip (strip_n);
|
boost::shared_ptr<Stripable> strip = mixer ().nth_strip (strip_n);
|
||||||
boost::shared_ptr<PeakMeter> meter = strip->peak_meter ();
|
boost::shared_ptr<PeakMeter> meter = strip->peak_meter ();
|
||||||
float db = meter ? meter->meter_level (0, MeterMCP) : -193;
|
float db = meter ? meter->meter_level (0, MeterMCP) : -193;
|
||||||
update_all (Node::strip_meter, strip_n, static_cast<double> (db));
|
update_all (Node::strip_meter, strip_n, static_cast<double> (db));
|
||||||
|
|
@ -179,7 +179,7 @@ ArdourFeedback::poll () const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourFeedback::observe_globals ()
|
ArdourFeedback::observe_transport ()
|
||||||
{
|
{
|
||||||
ARDOUR::Session& sess = session ();
|
ARDOUR::Session& sess = session ();
|
||||||
sess.TransportStateChange.connect (_signal_connections, MISSING_INVALIDATOR,
|
sess.TransportStateChange.connect (_signal_connections, MISSING_INVALIDATOR,
|
||||||
|
|
@ -191,10 +191,10 @@ ArdourFeedback::observe_globals ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourFeedback::observe_strips ()
|
ArdourFeedback::observe_mixer ()
|
||||||
{
|
{
|
||||||
for (uint32_t strip_n = 0; strip_n < strips ().strip_count (); ++strip_n) {
|
for (uint32_t strip_n = 0; strip_n < mixer ().strip_count (); ++strip_n) {
|
||||||
boost::shared_ptr<Stripable> strip = strips ().nth_strip (strip_n);
|
boost::shared_ptr<Stripable> strip = mixer ().nth_strip (strip_n);
|
||||||
|
|
||||||
strip->gain_control ()->Changed.connect (_signal_connections, MISSING_INVALIDATOR,
|
strip->gain_control ()->Changed.connect (_signal_connections, MISSING_INVALIDATOR,
|
||||||
boost::bind<void> (StripGainObserver (), this, strip_n), event_loop ());
|
boost::bind<void> (StripGainObserver (), this, strip_n), event_loop ());
|
||||||
|
|
@ -215,7 +215,7 @@ void
|
||||||
ArdourFeedback::observe_strip_plugins (uint32_t strip_n, boost::shared_ptr<ARDOUR::Stripable> strip)
|
ArdourFeedback::observe_strip_plugins (uint32_t strip_n, boost::shared_ptr<ARDOUR::Stripable> strip)
|
||||||
{
|
{
|
||||||
for (uint32_t plugin_n = 0;; ++plugin_n) {
|
for (uint32_t plugin_n = 0;; ++plugin_n) {
|
||||||
boost::shared_ptr<PluginInsert> insert = strips ().strip_plugin_insert (strip_n, plugin_n);
|
boost::shared_ptr<PluginInsert> insert = mixer ().strip_plugin_insert (strip_n, plugin_n);
|
||||||
if (!insert) {
|
if (!insert) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -240,7 +240,7 @@ ArdourFeedback::observe_strip_plugin_param_values (uint32_t strip_n,
|
||||||
boost::shared_ptr<Plugin> plugin = insert->plugin ();
|
boost::shared_ptr<Plugin> plugin = insert->plugin ();
|
||||||
|
|
||||||
for (uint32_t param_n = 0; param_n < plugin->parameter_count (); ++param_n) {
|
for (uint32_t param_n = 0; param_n < plugin->parameter_count (); ++param_n) {
|
||||||
boost::shared_ptr<AutomationControl> control = strips ().strip_plugin_param_control (
|
boost::shared_ptr<AutomationControl> control = mixer ().strip_plugin_param_control (
|
||||||
strip_n, plugin_n, param_n);
|
strip_n, plugin_n, param_n);
|
||||||
|
|
||||||
if (!control) {
|
if (!control) {
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,8 @@ private:
|
||||||
|
|
||||||
bool poll () const;
|
bool poll () const;
|
||||||
|
|
||||||
void observe_globals ();
|
void observe_transport ();
|
||||||
void observe_strips ();
|
void observe_mixer ();
|
||||||
void observe_strip_plugins (uint32_t, boost::shared_ptr<ARDOUR::Stripable>);
|
void observe_strip_plugins (uint32_t, boost::shared_ptr<ARDOUR::Stripable>);
|
||||||
void observe_strip_plugin_param_values (uint32_t, uint32_t,
|
void observe_strip_plugin_param_values (uint32_t, uint32_t,
|
||||||
boost::shared_ptr<ARDOUR::PluginInsert>);
|
boost::shared_ptr<ARDOUR::PluginInsert>);
|
||||||
|
|
|
||||||
|
|
@ -21,12 +21,12 @@
|
||||||
#include "ardour/session.h"
|
#include "ardour/session.h"
|
||||||
#include "pbd/controllable.h"
|
#include "pbd/controllable.h"
|
||||||
|
|
||||||
#include "strips.h"
|
#include "mixer.h"
|
||||||
|
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
int
|
int
|
||||||
ArdourStrips::start ()
|
ArdourMixer::start ()
|
||||||
{
|
{
|
||||||
/* take an indexed snapshot of current strips */
|
/* take an indexed snapshot of current strips */
|
||||||
StripableList strips;
|
StripableList strips;
|
||||||
|
|
@ -40,14 +40,14 @@ ArdourStrips::start ()
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
ArdourStrips::stop ()
|
ArdourMixer::stop ()
|
||||||
{
|
{
|
||||||
_strips.clear ();
|
_strips.clear ();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
ArdourStrips::to_db (double k)
|
ArdourMixer::to_db (double k)
|
||||||
{
|
{
|
||||||
if (k == 0) {
|
if (k == 0) {
|
||||||
return -std::numeric_limits<double>::infinity ();
|
return -std::numeric_limits<double>::infinity ();
|
||||||
|
|
@ -59,7 +59,7 @@ ArdourStrips::to_db (double k)
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
ArdourStrips::from_db (double db)
|
ArdourMixer::from_db (double db)
|
||||||
{
|
{
|
||||||
if (db < -192) {
|
if (db < -192) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -71,19 +71,19 @@ ArdourStrips::from_db (double db)
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
ArdourStrips::strip_gain (uint32_t strip_n) const
|
ArdourMixer::strip_gain (uint32_t strip_n) const
|
||||||
{
|
{
|
||||||
return to_db (nth_strip (strip_n)->gain_control ()->get_value ());
|
return to_db (nth_strip (strip_n)->gain_control ()->get_value ());
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourStrips::set_strip_gain (uint32_t strip_n, double db)
|
ArdourMixer::set_strip_gain (uint32_t strip_n, double db)
|
||||||
{
|
{
|
||||||
nth_strip (strip_n)->gain_control ()->set_value (from_db (db), PBD::Controllable::NoGroup);
|
nth_strip (strip_n)->gain_control ()->set_value (from_db (db), PBD::Controllable::NoGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
ArdourStrips::strip_pan (uint32_t strip_n) const
|
ArdourMixer::strip_pan (uint32_t strip_n) const
|
||||||
{
|
{
|
||||||
boost::shared_ptr<AutomationControl> ac = nth_strip (strip_n)->pan_azimuth_control ();
|
boost::shared_ptr<AutomationControl> ac = nth_strip (strip_n)->pan_azimuth_control ();
|
||||||
if (!ac) {
|
if (!ac) {
|
||||||
|
|
@ -95,7 +95,7 @@ ArdourStrips::strip_pan (uint32_t strip_n) const
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourStrips::set_strip_pan (uint32_t strip_n, double value)
|
ArdourMixer::set_strip_pan (uint32_t strip_n, double value)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<AutomationControl> ac = nth_strip (strip_n)->pan_azimuth_control ();
|
boost::shared_ptr<AutomationControl> ac = nth_strip (strip_n)->pan_azimuth_control ();
|
||||||
if (!ac) {
|
if (!ac) {
|
||||||
|
|
@ -107,38 +107,38 @@ ArdourStrips::set_strip_pan (uint32_t strip_n, double value)
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ArdourStrips::strip_mute (uint32_t strip_n) const
|
ArdourMixer::strip_mute (uint32_t strip_n) const
|
||||||
{
|
{
|
||||||
return nth_strip (strip_n)->mute_control ()->muted ();
|
return nth_strip (strip_n)->mute_control ()->muted ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourStrips::set_strip_mute (uint32_t strip_n, bool mute)
|
ArdourMixer::set_strip_mute (uint32_t strip_n, bool mute)
|
||||||
{
|
{
|
||||||
nth_strip (strip_n)->mute_control ()->set_value (mute ? 1.0 : 0.0, PBD::Controllable::NoGroup);
|
nth_strip (strip_n)->mute_control ()->set_value (mute ? 1.0 : 0.0, PBD::Controllable::NoGroup);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ArdourStrips::strip_plugin_enabled (uint32_t strip_n, uint32_t plugin_n) const
|
ArdourMixer::strip_plugin_enabled (uint32_t strip_n, uint32_t plugin_n) const
|
||||||
{
|
{
|
||||||
return strip_plugin_insert (strip_n, plugin_n)->enabled ();
|
return strip_plugin_insert (strip_n, plugin_n)->enabled ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourStrips::set_strip_plugin_enabled (uint32_t strip_n, uint32_t plugin_n, bool enabled)
|
ArdourMixer::set_strip_plugin_enabled (uint32_t strip_n, uint32_t plugin_n, bool enabled)
|
||||||
{
|
{
|
||||||
strip_plugin_insert (strip_n, plugin_n)->enable (enabled);
|
strip_plugin_insert (strip_n, plugin_n)->enable (enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedValue
|
TypedValue
|
||||||
ArdourStrips::strip_plugin_param_value (uint32_t strip_n, uint32_t plugin_n,
|
ArdourMixer::strip_plugin_param_value (uint32_t strip_n, uint32_t plugin_n,
|
||||||
uint32_t param_n) const
|
uint32_t param_n) const
|
||||||
{
|
{
|
||||||
return plugin_param_value (strip_plugin_param_control (strip_n, plugin_n, param_n));
|
return plugin_param_value (strip_plugin_param_control (strip_n, plugin_n, param_n));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourStrips::set_strip_plugin_param_value (uint32_t strip_n, uint32_t plugin_n,
|
ArdourMixer::set_strip_plugin_param_value (uint32_t strip_n, uint32_t plugin_n,
|
||||||
uint32_t param_n, TypedValue value)
|
uint32_t param_n, TypedValue value)
|
||||||
{
|
{
|
||||||
boost::shared_ptr<AutomationControl> control = strip_plugin_param_control (
|
boost::shared_ptr<AutomationControl> control = strip_plugin_param_control (
|
||||||
|
|
@ -161,13 +161,13 @@ ArdourStrips::set_strip_plugin_param_value (uint32_t strip_n, uint32_t plugin_n,
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t
|
uint32_t
|
||||||
ArdourStrips::strip_count () const
|
ArdourMixer::strip_count () const
|
||||||
{
|
{
|
||||||
return _strips.size ();
|
return _strips.size ();
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<Stripable>
|
boost::shared_ptr<Stripable>
|
||||||
ArdourStrips::nth_strip (uint32_t strip_n) const
|
ArdourMixer::nth_strip (uint32_t strip_n) const
|
||||||
{
|
{
|
||||||
if (strip_n < _strips.size ()) {
|
if (strip_n < _strips.size ()) {
|
||||||
return _strips[strip_n];
|
return _strips[strip_n];
|
||||||
|
|
@ -177,7 +177,7 @@ ArdourStrips::nth_strip (uint32_t strip_n) const
|
||||||
}
|
}
|
||||||
|
|
||||||
TypedValue
|
TypedValue
|
||||||
ArdourStrips::plugin_param_value (boost::shared_ptr<ARDOUR::AutomationControl> control)
|
ArdourMixer::plugin_param_value (boost::shared_ptr<ARDOUR::AutomationControl> control)
|
||||||
{
|
{
|
||||||
TypedValue value = TypedValue ();
|
TypedValue value = TypedValue ();
|
||||||
|
|
||||||
|
|
@ -197,7 +197,7 @@ ArdourStrips::plugin_param_value (boost::shared_ptr<ARDOUR::AutomationControl> c
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<PluginInsert>
|
boost::shared_ptr<PluginInsert>
|
||||||
ArdourStrips::strip_plugin_insert (uint32_t strip_n, uint32_t plugin_n) const
|
ArdourMixer::strip_plugin_insert (uint32_t strip_n, uint32_t plugin_n) const
|
||||||
{
|
{
|
||||||
boost::shared_ptr<Stripable> strip = nth_strip (strip_n);
|
boost::shared_ptr<Stripable> strip = nth_strip (strip_n);
|
||||||
|
|
||||||
|
|
@ -222,7 +222,7 @@ ArdourStrips::strip_plugin_insert (uint32_t strip_n, uint32_t plugin_n) const
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::shared_ptr<AutomationControl>
|
boost::shared_ptr<AutomationControl>
|
||||||
ArdourStrips::strip_plugin_param_control (uint32_t strip_n, uint32_t plugin_n,
|
ArdourMixer::strip_plugin_param_control (uint32_t strip_n, uint32_t plugin_n,
|
||||||
uint32_t param_n) const
|
uint32_t param_n) const
|
||||||
{
|
{
|
||||||
boost::shared_ptr<PluginInsert> insert = strip_plugin_insert (strip_n, plugin_n);
|
boost::shared_ptr<PluginInsert> insert = strip_plugin_insert (strip_n, plugin_n);
|
||||||
|
|
@ -16,18 +16,18 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ardour_surface_websockets_strips_h_
|
#ifndef _ardour_surface_websockets_mixer_h_
|
||||||
#define _ardour_surface_websockets_strips_h_
|
#define _ardour_surface_websockets_mixer_h_
|
||||||
|
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
#include "typed_value.h"
|
#include "typed_value.h"
|
||||||
|
|
||||||
class ArdourStrips : public SurfaceComponent
|
class ArdourMixer : public SurfaceComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArdourStrips (ArdourSurface::ArdourWebsockets& surface)
|
ArdourMixer (ArdourSurface::ArdourWebsockets& surface)
|
||||||
: SurfaceComponent (surface){};
|
: SurfaceComponent (surface){};
|
||||||
virtual ~ArdourStrips (){};
|
virtual ~ArdourMixer (){};
|
||||||
|
|
||||||
int start ();
|
int start ();
|
||||||
int stop ();
|
int stop ();
|
||||||
|
|
@ -65,4 +65,4 @@ private:
|
||||||
StripableVector _strips;
|
StripableVector _strips;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ardour_surface_websockets_strips_h_
|
#endif // _ardour_surface_websockets_mixer_h_
|
||||||
|
|
@ -31,10 +31,10 @@
|
||||||
|
|
||||||
namespace Node
|
namespace Node
|
||||||
{
|
{
|
||||||
const std::string tempo = "tempo";
|
const std::string transport_tempo = "transport_tempo";
|
||||||
const std::string position_time = "position_time";
|
const std::string transport_time = "transport_time";
|
||||||
const std::string transport_roll = "transport_roll";
|
const std::string transport_roll = "transport_roll";
|
||||||
const std::string record_state = "record_state";
|
const std::string transport_record = "transport_record";
|
||||||
const std::string strip_description = "strip_description";
|
const std::string strip_description = "strip_description";
|
||||||
const std::string strip_meter = "strip_meter";
|
const std::string strip_meter = "strip_meter";
|
||||||
const std::string strip_gain = "strip_gain";
|
const std::string strip_gain = "strip_gain";
|
||||||
|
|
|
||||||
|
|
@ -18,19 +18,19 @@
|
||||||
|
|
||||||
#include "ardour/tempo.h"
|
#include "ardour/tempo.h"
|
||||||
|
|
||||||
#include "globals.h"
|
#include "transport.h"
|
||||||
|
|
||||||
using namespace ARDOUR;
|
using namespace ARDOUR;
|
||||||
|
|
||||||
double
|
double
|
||||||
ArdourGlobals::tempo () const
|
ArdourTransport::tempo () const
|
||||||
{
|
{
|
||||||
Tempo tempo = session ().tempo_map ().tempo_at_sample (0);
|
Tempo tempo = session ().tempo_map ().tempo_at_sample (0);
|
||||||
return tempo.note_type () * tempo.pulses_per_minute ();
|
return tempo.note_type () * tempo.pulses_per_minute ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourGlobals::set_tempo (double bpm)
|
ArdourTransport::set_tempo (double bpm)
|
||||||
{
|
{
|
||||||
bpm = max (0.01, bpm);
|
bpm = max (0.01, bpm);
|
||||||
TempoMap& tempo_map = session ().tempo_map ();
|
TempoMap& tempo_map = session ().tempo_map ();
|
||||||
|
|
@ -39,7 +39,7 @@ ArdourGlobals::set_tempo (double bpm)
|
||||||
}
|
}
|
||||||
|
|
||||||
double
|
double
|
||||||
ArdourGlobals::position_time () const
|
ArdourTransport::time () const
|
||||||
{
|
{
|
||||||
samplepos_t t = session ().transport_sample ();
|
samplepos_t t = session ().transport_sample ();
|
||||||
samplecnt_t f = session ().sample_rate ();
|
samplecnt_t f = session ().sample_rate ();
|
||||||
|
|
@ -47,30 +47,30 @@ ArdourGlobals::position_time () const
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ArdourGlobals::transport_roll () const
|
ArdourTransport::roll () const
|
||||||
{
|
{
|
||||||
return basic_ui ().transport_rolling ();
|
return basic_ui ().transport_rolling ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourGlobals::set_transport_roll (bool value)
|
ArdourTransport::set_roll (bool value)
|
||||||
{
|
{
|
||||||
if ((value && !transport_roll ()) || (!value && transport_roll ())) {
|
if ((value && !roll ()) || (!value && roll ())) {
|
||||||
// this call is equivalent to hitting the spacebar
|
// this call is equivalent to hitting the spacebar
|
||||||
basic_ui ().toggle_roll (false);
|
basic_ui ().toggle_roll (false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ArdourGlobals::record_state () const
|
ArdourTransport::record () const
|
||||||
{
|
{
|
||||||
return session ().get_record_enabled ();
|
return session ().get_record_enabled ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ArdourGlobals::set_record_state (bool value)
|
ArdourTransport::set_record (bool value)
|
||||||
{
|
{
|
||||||
if ((value && !record_state ()) || (!value && record_state ())) {
|
if ((value && !record ()) || (!value && record ())) {
|
||||||
basic_ui ().rec_enable_toggle ();
|
basic_ui ().rec_enable_toggle ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,28 +16,28 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _ardour_surface_websockets_globals_h_
|
#ifndef _ardour_surface_websockets_transport_h_
|
||||||
#define _ardour_surface_websockets_globals_h_
|
#define _ardour_surface_websockets_transport_h_
|
||||||
|
|
||||||
#include "component.h"
|
#include "component.h"
|
||||||
|
|
||||||
class ArdourGlobals : public SurfaceComponent
|
class ArdourTransport : public SurfaceComponent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ArdourGlobals (ArdourSurface::ArdourWebsockets& surface)
|
ArdourTransport (ArdourSurface::ArdourWebsockets& surface)
|
||||||
: SurfaceComponent (surface){};
|
: SurfaceComponent (surface){};
|
||||||
virtual ~ArdourGlobals (){};
|
virtual ~ArdourTransport (){};
|
||||||
|
|
||||||
double tempo () const;
|
double tempo () const;
|
||||||
void set_tempo (double);
|
void set_tempo (double);
|
||||||
|
|
||||||
double position_time () const;
|
double time () const;
|
||||||
|
|
||||||
bool transport_roll () const;
|
bool roll () const;
|
||||||
void set_transport_roll (bool);
|
void set_roll (bool);
|
||||||
|
|
||||||
bool record_state () const;
|
bool record () const;
|
||||||
void set_record_state (bool);
|
void set_record (bool);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _ardour_surface_websockets_globals_h_
|
#endif // _ardour_surface_websockets_transport_h_
|
||||||
|
|
@ -22,8 +22,8 @@ def build(bld):
|
||||||
message.cc
|
message.cc
|
||||||
client.cc
|
client.cc
|
||||||
component.cc
|
component.cc
|
||||||
strips.cc
|
mixer.cc
|
||||||
globals.cc
|
transport.cc
|
||||||
server.cc
|
server.cc
|
||||||
feedback.cc
|
feedback.cc
|
||||||
dispatcher.cc
|
dispatcher.cc
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,6 @@
|
||||||
export const JSON_INF = 1.0e+128;
|
export const JSON_INF = 1.0e+128;
|
||||||
|
|
||||||
export const StateNode = Object.freeze({
|
export const StateNode = Object.freeze({
|
||||||
TEMPO: 'tempo',
|
|
||||||
POSITION_TIME: 'position_time',
|
|
||||||
TRANSPORT_ROLL: 'transport_roll',
|
|
||||||
RECORD_STATE: 'record_state',
|
|
||||||
STRIP_DESCRIPTION: 'strip_description',
|
STRIP_DESCRIPTION: 'strip_description',
|
||||||
STRIP_METER: 'strip_meter',
|
STRIP_METER: 'strip_meter',
|
||||||
STRIP_GAIN: 'strip_gain',
|
STRIP_GAIN: 'strip_gain',
|
||||||
|
|
@ -31,7 +27,11 @@ export const StateNode = Object.freeze({
|
||||||
STRIP_PLUGIN_DESCRIPTION: 'strip_plugin_description',
|
STRIP_PLUGIN_DESCRIPTION: 'strip_plugin_description',
|
||||||
STRIP_PLUGIN_ENABLE: 'strip_plugin_enable',
|
STRIP_PLUGIN_ENABLE: 'strip_plugin_enable',
|
||||||
STRIP_PLUGIN_PARAM_DESCRIPTION: 'strip_plugin_param_description',
|
STRIP_PLUGIN_PARAM_DESCRIPTION: 'strip_plugin_param_description',
|
||||||
STRIP_PLUGIN_PARAM_VALUE: 'strip_plugin_param_value'
|
STRIP_PLUGIN_PARAM_VALUE: 'strip_plugin_param_value',
|
||||||
|
TRANSPORT_TEMPO: 'transport_tempo',
|
||||||
|
TRANSPORT_TIME: 'transport_time',
|
||||||
|
TRANSPORT_ROLL: 'transport_roll',
|
||||||
|
TRANSPORT_RECORD: 'transport_record'
|
||||||
});
|
});
|
||||||
|
|
||||||
export class Message {
|
export class Message {
|
||||||
|
|
|
||||||
|
|
@ -56,30 +56,12 @@ export class Mixer extends RootComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} else {
|
||||||
|
// all initial strip description messages have been received at this point
|
||||||
/*
|
if (!this._ready) {
|
||||||
RECORD_STATE signals all mixer initial state has been sent because
|
|
||||||
it is the last message to arrive immediately after client connection,
|
|
||||||
see WebsocketsDispatcher::update_all_nodes() in dispatcher.cc
|
|
||||||
|
|
||||||
For this to work the mixer component needs to receive incoming
|
|
||||||
messages before the transport component, otherwise the latter would
|
|
||||||
consume RECORD_STATE.
|
|
||||||
|
|
||||||
Some ideas for a better implementation of mixer readiness detection:
|
|
||||||
|
|
||||||
- Implement message bundles like OSC to pack all initial state
|
|
||||||
updates into a single unit
|
|
||||||
- Move *_DESCRIPTION messages to single message with val={JSON data},
|
|
||||||
currently val only supports primitive data types
|
|
||||||
- Append a termination or mixer ready message in update_all_nodes(),
|
|
||||||
easiest but the least elegant
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!this._ready && (node == StateNode.RECORD_STATE)) {
|
|
||||||
this.updateLocal('ready', true);
|
this.updateLocal('ready', true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ export class Transport extends RootComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
set tempo (bpm) {
|
set tempo (bpm) {
|
||||||
this.updateRemote('tempo', bpm, StateNode.TEMPO);
|
this.updateRemote('tempo', bpm, StateNode.TRANSPORT_TEMPO);
|
||||||
}
|
}
|
||||||
|
|
||||||
get roll () {
|
get roll () {
|
||||||
|
|
@ -54,21 +54,21 @@ export class Transport extends RootComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
set record (value) {
|
set record (value) {
|
||||||
this.updateRemote('record', value, StateNode.RECORD_STATE);
|
this.updateRemote('record', value, StateNode.TRANSPORT_RECORD);
|
||||||
}
|
}
|
||||||
|
|
||||||
handle (node, addr, val) {
|
handle (node, addr, val) {
|
||||||
switch (node) {
|
switch (node) {
|
||||||
case StateNode.TEMPO:
|
case StateNode.TRANSPORT_TEMPO:
|
||||||
this.updateLocal('tempo', val[0]);
|
this.updateLocal('tempo', val[0]);
|
||||||
break;
|
break;
|
||||||
case StateNode.POSITION_TIME:
|
case StateNode.TRANSPORT_TIME:
|
||||||
this.updateLocal('time', val[0]);
|
this.updateLocal('time', val[0]);
|
||||||
break;
|
break;
|
||||||
case StateNode.TRANSPORT_ROLL:
|
case StateNode.TRANSPORT_ROLL:
|
||||||
this.updateLocal('roll', val[0]);
|
this.updateLocal('roll', val[0]);
|
||||||
break;
|
break;
|
||||||
case StateNode.RECORD_STATE:
|
case StateNode.TRANSPORT_RECORD:
|
||||||
this.updateLocal('record', val[0]);
|
this.updateLocal('record', val[0]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue