Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Implement Plugin::get_editor() for PluginInstance #6

Closed
conundrumer opened this issue Aug 13, 2017 · 7 comments
Closed

Implement Plugin::get_editor() for PluginInstance #6

conundrumer opened this issue Aug 13, 2017 · 7 comments

Comments

@conundrumer
Copy link
Contributor

overdrivenpotato/rust-vst2#33

If someone is interested in doing this, that'd be great (I'm quite busy atm).
It only requires creating a PluginInstanceEditor struct and storing it in the PluginInstance struct, it can be filled with values gotten from sending the editor OpCodes to the instance, EditorGetRect etc. Basically look at for which OpCodes interfaces::dispatch() calls plugin.get_editor() and "invert" that direction to construct a PluginInstanceEditor.

@askeksa askeksa self-assigned this Mar 20, 2019
@askeksa
Copy link
Contributor

askeksa commented Mar 20, 2019

Since #65 changes the way the Editor is returned (making it a boxed instance), the description of how to implement this is no longer accurate.

I will take a stab at this after #65 lands.

@inikulin
Copy link
Contributor

inikulin commented Jan 2, 2020

It seems like this has been implemented and the issue can be closed.

@askeksa
Copy link
Contributor

askeksa commented Jan 2, 2020

Currently, PluginInstance only has the default implementation of get_editor, which simply returns None. This issue is about the implementation returning an object which dispatches editor calls to the plugin.

@fumieval
Copy link

fumieval commented Jan 4, 2020

I rebased the commit mentioned and changed the type of get_editor to return Arc<Mutex<dyn Editor>> (ae24c7b) because the old type doesn't really work in host application code. I'm new to Rust so I'm not 100% sure if that's the right approach.

@askeksa
Copy link
Contributor

askeksa commented Jan 4, 2020

Part of the design philosophy of the thread safe API restructuring was to not force users into specific synchronization mechanisms. So we should not have Mutex as part of the API anywhere.

The reason for using a Box here is to allow calls to be made into the Editor concurrently with the main Plugin while still allowing it to have mutable methods. Communication between the Editor and the Plugin can happen through shared references to the PluginParameters.

What do you mean when you say that the old type doesn't really work in host application code?

@fumieval
Copy link

fumieval commented Jan 4, 2020

Oh, I had a brainfart, Box just works. Thanks for clarification!

@askeksa
Copy link
Contributor

askeksa commented Jan 4, 2020

Thanks for adapting the code to the thread-safe API. I have added some comments to the commit.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants