Namespace libwebsocket surface classes
Using the global names-pace for classes named "Json", "TypedValue", "ArdourTransport", "ArdourMixerPlugin" etc is not acceptable.
This commit is contained in:
parent
665e0686e5
commit
af79240c81
|
@ -39,8 +39,8 @@
|
|||
#include "server.h"
|
||||
#include "mixer.h"
|
||||
|
||||
namespace ArdourSurface
|
||||
{
|
||||
namespace ArdourSurface {
|
||||
|
||||
const char * const surface_name = "WebSockets Server (Experimental)";
|
||||
const char * const surface_id = "uri://ardour.org/surfaces/ardour_websockets:0";
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "client.h"
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
bool
|
||||
ClientContext::has_state (const NodeState& node_state)
|
||||
{
|
||||
|
|
|
@ -25,7 +25,10 @@
|
|||
#include "message.h"
|
||||
#include "state.h"
|
||||
|
||||
typedef struct lws* Client;
|
||||
typedef struct lws* Client;
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
typedef std::list<NodeStateMessage> ClientOutputBuffer;
|
||||
|
||||
class ClientContext
|
||||
|
@ -59,4 +62,6 @@ private:
|
|||
ClientOutputBuffer _output_buf;
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_client_h_
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "component.h"
|
||||
#include "ardour_websockets.h"
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
BasicUI&
|
||||
SurfaceComponent::basic_ui () const
|
||||
{
|
||||
|
|
|
@ -28,9 +28,8 @@
|
|||
|
||||
namespace ArdourSurface
|
||||
{
|
||||
class ArdourWebsockets;
|
||||
}
|
||||
|
||||
class ArdourWebsockets;
|
||||
class ArdourMixer;
|
||||
class ArdourTransport;
|
||||
class WebsocketsServer;
|
||||
|
@ -66,4 +65,6 @@ protected:
|
|||
ArdourSurface::ArdourWebsockets& _surface;
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_component_h_
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "state.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace ArdourSurface;
|
||||
|
||||
#define NODE_METHOD_PAIR(x) (Node::x, &WebsocketsDispatcher::x##_handler)
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include "component.h"
|
||||
#include "message.h"
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class WebsocketsDispatcher : public SurfaceComponent
|
||||
{
|
||||
public:
|
||||
|
@ -57,4 +59,6 @@ private:
|
|||
void update (Client, std::string, const AddressVector&, const ValueVector&);
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_dispatcher_h_
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#define POLL_INTERVAL_MS 100
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace ArdourSurface;
|
||||
|
||||
struct TransportObserver {
|
||||
void operator() (ArdourFeedback* p)
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "typed_value.h"
|
||||
#include "mixer.h"
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class ArdourFeedback : public SurfaceComponent
|
||||
{
|
||||
public:
|
||||
|
@ -54,4 +56,6 @@ private:
|
|||
void observe_strip_plugins (uint32_t, ArdourMixerStrip::PluginMap&);
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_feedback_h_
|
||||
|
|
|
@ -21,10 +21,12 @@
|
|||
|
||||
#include "json.h"
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
/* adapted from https://stackoverflow.com/questions/7724448/simple-json-string-escape-for-c
|
||||
CC BY-SA 4.0 license */
|
||||
std::string
|
||||
Json::escape (const std::string &s) {
|
||||
WebSocketsJSON::escape (const std::string &s) {
|
||||
std::ostringstream o;
|
||||
|
||||
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
|
||||
|
|
|
@ -19,9 +19,13 @@
|
|||
#ifndef _ardour_surface_websockets_json_h_
|
||||
#define _ardour_surface_websockets_json_h_
|
||||
|
||||
namespace Json
|
||||
namespace ArdourSurface {
|
||||
|
||||
namespace WebSocketsJSON
|
||||
{
|
||||
std::string escape (const std::string&);
|
||||
}
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_json_h_
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "resources.h"
|
||||
#include "json.h"
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
static const char* const manifest_filename = "manifest.xml";
|
||||
|
||||
SurfaceManifest::SurfaceManifest (std::string path)
|
||||
|
@ -77,10 +79,10 @@ SurfaceManifest::to_json ()
|
|||
std::stringstream ss;
|
||||
|
||||
ss << "{"
|
||||
<< "\"path\":\"" << Json::escape (Glib::path_get_basename (_path)) << "\""
|
||||
<< ",\"name\":\"" << Json::escape (_name) << "\""
|
||||
<< ",\"description\":\"" << Json::escape (_description) << "\""
|
||||
<< ",\"version\":\"" << Json::escape (_version) << "\""
|
||||
<< "\"path\":\"" << WebSocketsJSON::escape (Glib::path_get_basename (_path)) << "\""
|
||||
<< ",\"name\":\"" << WebSocketsJSON::escape (_name) << "\""
|
||||
<< ",\"description\":\"" << WebSocketsJSON::escape (_description) << "\""
|
||||
<< ",\"version\":\"" << WebSocketsJSON::escape (_version) << "\""
|
||||
<< "}";
|
||||
|
||||
return ss.str ();
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class SurfaceManifest
|
||||
{
|
||||
public:
|
||||
|
@ -47,4 +49,6 @@ private:
|
|||
std::string _version;
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_manifest_h_
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#define JSON_INF 1.0e+128
|
||||
#define JSON_INF_STR XSTR (JSON_INF)
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
namespace pt = boost::property_tree;
|
||||
|
||||
NodeStateMessage::NodeStateMessage (const NodeState& state)
|
||||
|
@ -167,7 +169,7 @@ NodeStateMessage::serialize (void* buf, size_t len) const
|
|||
break;
|
||||
}
|
||||
case TypedValue::String:
|
||||
ss << '"' << Json::escape (static_cast<std::string> (val)) << '"';
|
||||
ss << '"' << WebSocketsJSON::escape (static_cast<std::string> (val)) << '"';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "state.h"
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class NodeStateMessage
|
||||
{
|
||||
public:
|
||||
|
@ -48,4 +50,6 @@ private:
|
|||
NodeState _state;
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_message_h_
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "mixer.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace ArdourSurface;
|
||||
|
||||
ArdourMixerPlugin::ArdourMixerPlugin (boost::shared_ptr<ARDOUR::PluginInsert> insert)
|
||||
: _insert (insert)
|
||||
|
|
|
@ -24,9 +24,11 @@
|
|||
#include "component.h"
|
||||
#include "typed_value.h"
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
struct ArdourMixerNotFoundException : public virtual std::runtime_error
|
||||
{
|
||||
using std::runtime_error::runtime_error;
|
||||
using std::runtime_error::runtime_error; // XXX!
|
||||
};
|
||||
|
||||
class ArdourMixerPlugin
|
||||
|
@ -120,4 +122,6 @@ private:
|
|||
Glib::Threads::Mutex _mutex;
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_mixer_h_
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "resources.h"
|
||||
#include "json.h"
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
static const char* const data_dir_env_var = "ARDOUR_WEBSURFACES_PATH";
|
||||
static const char* const data_dir_name = "web_surfaces";
|
||||
static const char* const builtin_dir_name = "builtin";
|
||||
|
@ -85,8 +87,8 @@ ServerResources::scan ()
|
|||
SurfaceManifestVector builtin = read_manifests (builtin_dir_str);
|
||||
|
||||
ss << "[{"
|
||||
<< "\"filesystemPath\":\"" << Json::escape (builtin_dir_str) << "\""
|
||||
<< ",\"path\":\"" << Json::escape (builtin_dir_name) << "\""
|
||||
<< "\"filesystemPath\":\"" << WebSocketsJSON::escape (builtin_dir_str) << "\""
|
||||
<< ",\"path\":\"" << WebSocketsJSON::escape (builtin_dir_name) << "\""
|
||||
<< ",\"surfaces\":"
|
||||
<< "[";
|
||||
|
||||
|
@ -101,8 +103,8 @@ ServerResources::scan ()
|
|||
SurfaceManifestVector user = read_manifests (user_dir_str);
|
||||
|
||||
ss << "]},{"
|
||||
<< "\"filesystemPath\":\"" << Json::escape (user_dir_str) << "\""
|
||||
<< ",\"path\":\"" << Json::escape (user_dir_name) << "\""
|
||||
<< "\"filesystemPath\":\"" << WebSocketsJSON::escape (user_dir_str) << "\""
|
||||
<< ",\"path\":\"" << WebSocketsJSON::escape (user_dir_name) << "\""
|
||||
<< ",\"surfaces\":"
|
||||
<< "[";
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include "manifest.h"
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
typedef std::vector<SurfaceManifest> SurfaceManifestVector;
|
||||
|
||||
class ServerResources
|
||||
|
@ -49,4 +51,6 @@ private:
|
|||
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_resources_h_
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#define MAX_INDEX_SIZE 65536
|
||||
|
||||
using namespace Glib;
|
||||
using namespace ArdourSurface;
|
||||
|
||||
WebsocketsServer::WebsocketsServer (ArdourSurface::ArdourWebsockets& surface)
|
||||
: SurfaceComponent (surface)
|
||||
|
|
|
@ -49,6 +49,8 @@ struct LwsPollFdGlibSource {
|
|||
};
|
||||
#endif
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class WebsocketsServer : public SurfaceComponent
|
||||
{
|
||||
public:
|
||||
|
@ -102,4 +104,6 @@ private:
|
|||
#endif
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_server_h_
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "state.h"
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
NodeState::NodeState () {}
|
||||
|
||||
NodeState::NodeState (std::string node)
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
|
||||
#define ADDR_NONE UINT_MAX
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
namespace Node
|
||||
{
|
||||
const std::string strip_description = "strip_description";
|
||||
|
@ -84,4 +86,6 @@ private:
|
|||
std::size_t
|
||||
hash_value (const NodeState&);
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_state_h_
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "transport.h"
|
||||
|
||||
using namespace ARDOUR;
|
||||
using namespace ArdourSurface;
|
||||
|
||||
double
|
||||
ArdourTransport::tempo () const
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "component.h"
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class ArdourTransport : public SurfaceComponent
|
||||
{
|
||||
public:
|
||||
|
@ -40,4 +42,6 @@ public:
|
|||
void set_record (bool);
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_transport_h_
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include "typed_value.h"
|
||||
|
||||
using namespace ArdourSurface;
|
||||
|
||||
#define DBL_TOLERANCE 0.001
|
||||
|
||||
TypedValue::TypedValue ()
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#ifndef _ardour_surface_websockets_typed_value_h_
|
||||
#define _ardour_surface_websockets_typed_value_h_
|
||||
|
||||
namespace ArdourSurface {
|
||||
|
||||
class TypedValue
|
||||
{
|
||||
public:
|
||||
|
@ -65,4 +67,6 @@ private:
|
|||
std::string _s;
|
||||
};
|
||||
|
||||
} // namespace ArdourSurface
|
||||
|
||||
#endif // _ardour_surface_websockets_typed_value_h_
|
||||
|
|
Loading…
Reference in New Issue
Block a user