Finish switching from vst3-sys to vst3#263
Finish switching from vst3-sys to vst3#263davemollen wants to merge 9 commits intorobbert-vdh:masterfrom
Conversation
| .spawn(parent_handle, self.inner.clone().make_gui_context()), | ||
| ); | ||
| *self.inner.plug_view.write() = Some(ObjectPtr::from(self)); | ||
| // *self.inner.plug_view.write() = Some(ObjectPtr::from(self)); |
There was a problem hiding this comment.
A solution still needs to be found for this line. A direct equivalent of ObjectPtr::from(self) is not possible with the vst3 crate.
| .map(|run_loop| RunLoopEventHandler::new(self.inner.clone(), run_loop)); | ||
| } | ||
| *self.plug_frame.write() = Some(VstPtr::from(frame)); | ||
| // *self.plug_frame.write() = Some(ComPtr::from(frame)); |
There was a problem hiding this comment.
Another line that still needs to be updated.
src/wrapper/vst3/view.rs
Outdated
| tasks: ArrayQueue::new(TASK_QUEUE_CAPACITY), | ||
| }); | ||
|
|
||
| let handler_ptr = &*handler as *const _ as *mut _; |
There was a problem hiding this comment.
This is not going to work at all. You can't just allocate a Box<RunLoopEventHandler> and then do an unsafe pointer cast to *mut IEventHandler.
The use of #[VST3(implements(IEventHandler))] above RunLoopEventHandler needs to be replaced with impl Class for RunLoopEventHandler, and the RunLoopEventHandler needs to be allocated with ComWrapper.
There was a problem hiding this comment.
I was afraid this wouldn't make much sense. Didn't really notice this in testing though.
There was a problem hiding this comment.
I applied your suggested changes here. Getting access to the IEventHandler pointer for the unregisterEventHandler call was a bit fiddly. Curious to hear if this looks right to you.
It feels a bit strange to store the ComPtr on the struct it's also pointing to, but don't know what other pattern could be used.
dd5c1dc to
76c5fb2
Compare
Switch from the vst3-sys crate to the vst3 crate. With this change VST3 plugins built with NIH-plug no longer depend on the GPLv3 license.
Changes:
Changes were tested on all platforms.