2020-02-20 07:12:36 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2009-2011 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2013-2016 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2015 Johannes Mueller <github@johannes-mueller.org>
|
|
|
|
* Copyright (C) 2016-2018 Len Ovens <len@ovenwerks.net>
|
|
|
|
* Copyright (C) 2016 Ben Loftis <ben@harrisonconsoles.com>
|
2021-06-13 10:32:18 -04:00
|
|
|
* Copyright (C) 2020 Luciano Iam <oss@lucianoiam.com>
|
2020-02-20 07:12:36 -05:00
|
|
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2020-02-23 10:13:22 -05:00
|
|
|
#ifndef _ardour_surface_websockets_h_
|
|
|
|
#define _ardour_surface_websockets_h_
|
2020-02-20 07:12:36 -05:00
|
|
|
|
|
|
|
#define ABSTRACT_UI_EXPORTS
|
|
|
|
#include "pbd/abstract_ui.h"
|
|
|
|
|
|
|
|
#include "ardour/plugin.h"
|
|
|
|
#include "control_protocol/control_protocol.h"
|
|
|
|
|
|
|
|
#include "component.h"
|
2020-02-23 10:03:59 -05:00
|
|
|
#include "dispatcher.h"
|
|
|
|
#include "feedback.h"
|
2020-05-30 13:08:27 -04:00
|
|
|
#include "transport.h"
|
2020-02-20 07:12:36 -05:00
|
|
|
#include "server.h"
|
2020-05-30 13:08:27 -04:00
|
|
|
#include "mixer.h"
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-08-30 15:15:07 -04:00
|
|
|
namespace ArdourSurface {
|
|
|
|
|
2020-04-09 09:57:09 -04:00
|
|
|
const char * const surface_name = "WebSockets Server (Experimental)";
|
|
|
|
const char * const surface_id = "uri://ardour.org/surfaces/ardour_websockets:0";
|
|
|
|
|
2020-02-20 07:12:36 -05:00
|
|
|
struct ArdourWebsocketsUIRequest : public BaseUI::BaseRequestObject {
|
2020-02-23 10:03:59 -05:00
|
|
|
public:
|
|
|
|
ArdourWebsocketsUIRequest () {}
|
|
|
|
~ArdourWebsocketsUIRequest () {}
|
2020-02-20 07:12:36 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
class ArdourWebsockets : public ARDOUR::ControlProtocol,
|
2020-02-23 10:03:59 -05:00
|
|
|
public AbstractUI<ArdourWebsocketsUIRequest>
|
2020-02-20 07:12:36 -05:00
|
|
|
{
|
2020-02-23 10:03:59 -05:00
|
|
|
public:
|
|
|
|
ArdourWebsockets (ARDOUR::Session&);
|
|
|
|
virtual ~ArdourWebsockets ();
|
|
|
|
|
|
|
|
static void* request_factory (uint32_t);
|
|
|
|
|
|
|
|
int set_active (bool);
|
|
|
|
|
|
|
|
ARDOUR::Session& ardour_session ()
|
|
|
|
{
|
|
|
|
return *session;
|
|
|
|
}
|
2020-05-30 13:08:27 -04:00
|
|
|
ArdourMixer& mixer_component ()
|
2020-02-23 10:03:59 -05:00
|
|
|
{
|
2020-05-30 13:08:27 -04:00
|
|
|
return _mixer;
|
2020-02-23 10:03:59 -05:00
|
|
|
}
|
2020-05-30 13:08:27 -04:00
|
|
|
ArdourTransport& transport_component ()
|
2020-02-23 10:03:59 -05:00
|
|
|
{
|
2020-05-30 13:08:27 -04:00
|
|
|
return _transport;
|
2020-02-23 10:03:59 -05:00
|
|
|
}
|
|
|
|
WebsocketsServer& server_component ()
|
|
|
|
{
|
|
|
|
return _server;
|
|
|
|
}
|
|
|
|
WebsocketsDispatcher& dispatcher_component ()
|
|
|
|
{
|
|
|
|
return _dispatcher;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ControlProtocol */
|
|
|
|
void stripable_selection_changed () {}
|
|
|
|
|
2022-05-16 17:24:27 -04:00
|
|
|
CONTROL_PROTOCOL_THREADS_NEED_TEMPO_MAP_DECL();
|
|
|
|
|
2020-02-23 10:03:59 -05:00
|
|
|
protected:
|
|
|
|
/* BaseUI */
|
|
|
|
void thread_init ();
|
|
|
|
|
|
|
|
/* AbstractUI */
|
|
|
|
void do_request (ArdourWebsocketsUIRequest*);
|
|
|
|
|
|
|
|
private:
|
2020-05-30 13:08:27 -04:00
|
|
|
ArdourMixer _mixer;
|
|
|
|
ArdourTransport _transport;
|
2020-02-23 10:03:59 -05:00
|
|
|
WebsocketsServer _server;
|
2021-06-13 14:54:43 -04:00
|
|
|
ArdourFeedback _feedback;
|
2020-02-23 10:03:59 -05:00
|
|
|
WebsocketsDispatcher _dispatcher;
|
|
|
|
std::vector<SurfaceComponent*> _components;
|
|
|
|
|
|
|
|
int start ();
|
|
|
|
int stop ();
|
2020-02-20 07:12:36 -05:00
|
|
|
};
|
|
|
|
|
2020-02-23 10:03:59 -05:00
|
|
|
} // namespace ArdourSurface
|
2020-02-20 07:12:36 -05:00
|
|
|
|
2020-04-09 09:49:06 -04:00
|
|
|
#endif // _ardour_surface_websockets_h_
|