-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webview extension (draft) #430
base: next
Are you sure you want to change the base?
Conversation
533e849
to
50f004f
Compare
…ends on package format)
I'm not a web tech person so this may be not useful. shouldn't the file be called all the functions are marked Shouldn't the protocol for get start and is open are unclear. Is it possible to write a state diagram like the one in gui.h? |
Maybe you could add this extension to the web-clap repository for now? |
I think that's pretty smart, @abique this space is nascent enough that you want a fast iteration sandbox and then bring it to us less-web-enlightened folks for reviews I really would focus on naming and protocol/state machine early on though. It's the kind of thing which is painful to fix, and long descriptive names are fine. That was basically my comment set. |
This extension isn't specific to WCLAP (although it's useful there), and doesn't depend on any of the WASM-specific decisions. If you'd like this to block on the WCLAP stuff for other reasons, then moving it makes sense. |
✅ I agree with this.
My reasoning was: the UI should be updated about both state save/load (main thread) and parameter update events (audio thread). The plugin could instead run its own message queue, post all the parameter updates there, request a main-thread callpack, and then forward them to the webview. This way was easier for the plugin, the other way would be easier for the host. 🤷
✅ Makes sense.
It should be possible to call either of them at any time. I wasn't imagining either of them would trigger a state-change.
|
every plugin already does this to update their native GUI. We don't ever want to encourage gui writes from the audio thread vs 'get the message to a lock free queue' approach. (the reason is that every
So can a host call |
Really great points - I'll improve this and sketch out a diagram.
From the perspective of a (occasionally lazy 😛) plugin developer, that seemed like wasted duplicate effort. The host will also have lock-free queues in its codebase already, and if the host got the message to its lock-free queue (instead of the plugin) then I thought perhaps the plugin wouldn't need to run such a queue at all, if it only supported the webview UI. (And the However, I'm doubting that now! The host can provide stronger guarantees about delivery if called on the main thread, and the plugin is also much more likely to know how big the queue should be, what to do if the queue is full, etc. Thanks for the feedback! |
Yeah clap helpers has a lock free queue as does juce and other packages. It’s already a paradigm plugins have. And frameworks wrap them if you want to think at a higher level. Also having a non allocating non blocking lock free data structure for a message of arbitrary size with multiple producers is …. Hard. And your api implies that a host has to implement that. Whereas the spsc fixed sized queues folks use to do interoperation between main and ui threads are well trodden and in almost every plugin codebase already great stuff. Very interesting to see this evolve. |
@baconpaul I've updated things based on your comments. The only method I left as I personally think However, we could also tell plugins to support |
This draft lets CLAP plugins straightforwardly use a web-page for their UI.
Messages are then exchanged in both directions as opaque blocks of bytes. The webpage receives and sends messages using standard web APIs.
The host is responsible for storing messages in suitable (lock- and allocation-free) queues.
Closes #416