13
0
Commit Graph

110 Commits

Author SHA1 Message Date
cc6b58ef00
Fix Windows builds (pthread handle abstraction) 2021-06-17 13:32:10 +02:00
f85bbaa97d
Fix C++11ism 2021-06-16 03:03:26 +02:00
Luciano Iam
04104b68a6 WebSockets: fix surface build for older systems 2021-06-14 14:50:48 +02:00
Luciano Iam
5fffe985bb WebSockets: update some source headers 2021-06-14 14:45:51 +02:00
Luciano Iam
6cc59ad8e6 WebSockets: update some comments in source
Based on feedback from libwebsockets author
https://github.com/warmcat/libwebsockets/issues/2322#issuecomment-860572124
2021-06-14 12:25:29 +02:00
Luciano Iam
f1d7e1759a WebSockets: repeat 8baf275 for JS files
Like ec131fc does
2021-06-14 10:25:45 +02:00
Luciano Iam
ebee3a8010 WebSockets: remove unnecessary code
Leftovers from copy and pasting from test_ui.cc
2021-06-14 10:02:25 +02:00
Luciano Iam
cb73eb350d WebSockets: less invasive version of 5407232
There is no need to connect signals twice, can connect them directly to the
helper UI loop and skip the surface loop. Then let the server decide if it is
necessary to call lws_cancel_service() or not.

Also rename WebsocketsServer::should_request_write() to read_blocks_event_loop()
it makes more sense for the caller now on-demand write logic is completely
implemented by the server class.
2021-06-14 10:02:25 +02:00
Luciano Iam
e3569b6469
WebSockets: notify server there are pending client updates
This is an update to the surface ArdourFeedback class that is needed to support
the new event loop integration method.

The various session event callbacks cannot be queued in the surface event loop
because that would create a delay between the time such events are fired and
the time for writing to clients arrive, due to lws_service() blocking while
it waits to read. To solve this issue a helper AbstractUI is created for
catching events as soon as possible and issuing a call to lws_cancel_service().

See WebsocketsServer::glib_idle_callback()
2021-06-13 22:00:29 +02:00
Luciano Iam
b3661af92a
WebSockets: additional method for event loop integration
Some distro repositories offer versions of libwebsockets that have not been
compiled with LWS_WITH_GLIB or LWS_WITH_EXTERNAL_POLL enabled. For such cases
a different event loop integration method is needed.

True for Ubuntu 20.04 as of Jun '21
2021-06-13 22:00:29 +02:00
Luciano Iam
5f504f23ac
WebSockets: reduce server log verbosity 2021-06-13 22:00:28 +02:00
Luciano Iam
373d905a93
Update websockets surface author email in source files 2021-06-13 22:00:28 +02:00
Luciano Iam
12a7480ea3
Move #include inside header guard 2021-06-13 22:00:28 +02:00
ce43161d4e
WebSockets: log hostname and listen-port 2020-11-23 20:12:57 +01:00
7d4cd5c76a
Fix C++11ism 2020-11-20 13:32:20 +01:00
Luciano Iam
9ee828b47b
WS: properly support MIDI strips 2020-11-19 17:03:36 +01:00
Luciano Iam
9c08c058a3
WS: crash bugfix related to missing strip panner
Surface made Ardour crash when a client connected
and some session track was not a VCA nor had a panner,
like MIDI strips.
2020-09-04 01:59:53 +02:00
63a117bf93
And another boost/C++11 fix
This fixes Undefined symbols:
"ArdourSurface::hash_value(ArdourSurface::NodeState const&)", referenced from:
  boost::hash<ArdourSurface::NodeState>::operator()(ArdourSurface::NodeState const&) constin client.cc.1.o
  boost::hash<ArdourSurface::NodeState>::operator()(ArdourSurface::NodeState const&) constin server.cc.1.o
2020-08-31 08:28:50 +02:00
a9c2350e87
Fix yet another C++11ism 2020-08-31 07:52:48 +02:00
39110463f3
Amend cdd48926d1 use ScopedConnectionList directly 2020-08-31 07:41:11 +02:00
cdd48926d1
Remove more libwebsocket C++11isms
* amend previous commit, fix runtime_error implementation
* Do not copy-construct classes that have a PBD::scoped connection list.
  Replace std::map::emplace[C+11], an store shared pointers the std::map.
* Update ArdourMixerStrip is-a ScopedConnectionList (not has-a)
2020-08-30 22:57:43 +02:00
8eb4dcb675
Fix websocket C++11ism 2020-08-30 21:15:33 +02:00
af79240c81
Namespace libwebsocket surface classes
Using the global names-pace for classes named "Json", "TypedValue",
"ArdourTransport", "ArdourMixerPlugin" etc is not acceptable.
2020-08-30 21:15:07 +02:00
Luciano Iam
665e0686e5
WS: noop use a namespace for JSON utilities
Instead of a class with static methods

Also correct some whitespace to prevent triggering of OCD cycles
2020-08-30 19:29:28 +02:00
Luciano Iam
aa38491b7d
WS: move VCA detection to mixer strip interface
Expose the wrapped Stripable the least as possible
2020-08-30 19:29:28 +02:00
Luciano Iam
e510c0cb75
WS: consistent naming of strip/plugin/param identifiers
Rename all {object}_n variables and arguments to {object}_id

Parts of code were using the former convention, now use the latter everywhere
Another step towards supporting visual position agnostic identifiers in the future
2020-08-30 19:29:28 +02:00
Luciano Iam
c32a5917f3
WS: handle strips and plugins removal 2020-08-30 19:29:27 +02:00
Luciano Iam
a8f917e7e2
WS: prepare for handling object disconnections
Use maps instead of vectors for holding strips and plugins
This allows to deal with "holes" after objects are removed

Also paves the way for a future improved way of identifying
individual strips and plugins
2020-08-30 19:29:27 +02:00
Luciano Iam
7521d8ab6f
WS: add some meaningful error messages 2020-08-30 19:29:27 +02:00
Luciano Iam
3509fe1589
WS: use an object-oriented internal API for the mixer
- This allows to better handle strips & plugins connection lifecycles
- Coherent with the JS client design
2020-08-30 19:29:27 +02:00
Luciano Iam
4a4734fbb1
WebSockets: properly release strips and plugins when removed
This should fix some crashes reported by the beta testing team
2020-08-30 19:29:27 +02:00
dfe2270c9f
Revert "WebSockets: properly release strips and plugins when removed"
This reverts commit f007ba6b46.
2020-08-19 23:59:38 +02:00
Luciano Iam
f007ba6b46
WebSockets: properly release strips and plugins when removed
This should fix some crashes reported by the beta testing team
2020-08-19 19:01:18 +02:00
Luciano Iam
e7e4fb3a81
WS: Use Ardour native scale for pan knobs 2020-07-21 06:49:28 +02:00
23feb0491e
Remove using std::min/max from header 2020-06-18 01:05:48 +02:00
Luciano Iam
8ff4bcfd68
WebSockets: improve JS client message handling code 2020-06-10 19:47:37 +02:00
Luciano Iam
a26a9018fd
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.
2020-06-10 19:47:37 +02:00
Luciano Iam
ae4df127ad
WebSockets: implement a JavaScript object-oriented client API
Replace previous callback based basic client with an easier
to use object-oriented API that further abstracts the low level
details of the WebSockets Server surface messaging protocol.

All built-in web surface demos were updated to use the new API.
2020-06-10 19:47:37 +02:00
5296ed141f
Fix support for older libwebsocket versions
LWS_WITH_EXTERNAL_POLL a new optional define for libwebsocket 4.x.
Earlier versions always supported it, without the compile-time define.

This fixes support for libwesocket 2.x (Debian, Ubuntu), and 3.x.
Also for Windows, LWS_WITH_GLIB is not available.
2020-06-10 15:58:47 +02:00
Luciano Iam
e253302c62
WebSockets: allow compilation with lws < 2.1.0
Old libwebsockets does not define lws_callback_http_dummy()
Conditionally use custom code instead
2020-05-28 18:56:21 +02:00
Luciano Iam
3840264edd
WebSockets: remove usage of lws constant LLL_USER
It is not available on lws 2 and really not needed
2020-05-28 18:56:21 +02:00
Luciano Iam
c3d72625cd
WebSockets: leverage LWS_WITH_GLIB 2020-05-28 18:56:21 +02:00
Luciano Iam
85d1aa30d5
WebSockets: comment out a lws_callback case that made clients hang 2020-05-28 18:56:21 +02:00
Luciano Iam
7554655616
WebSockets: improve libwebsockets 4 compatibility
After upgrading from lws 3 to 4 clients could still connect to the surface but no data was sent from the server.
2020-05-28 18:56:21 +02:00
Luciano Iam
6e5aeb57b3
WebSockets: fix LWS_WITH_EXTERNAL_POLL check 2020-05-28 18:56:20 +02:00
Luciano Iam
ea16fc51d3
WebSockets: fix guard header in json.h 2020-04-22 21:59:35 +02:00
Luciano Iam
dbb26daafa
WebSockets: also json-escape strings in state messages 2020-04-22 21:59:35 +02:00
Luciano Iam
946094b25c
WebSockets: also json-escape paths in manifests
Extends 3c423d9
2020-04-22 21:59:35 +02:00
Luciano Iam
c362605b49
WebSockets: add some TO DO comments 2020-04-22 21:59:35 +02:00
Luciano Iam
8b65b0a961
WebSockets: disable http caching if NDEBUG is set
This is useful while developing web surface javascript code
2020-04-22 21:59:35 +02:00