I encountered a requirement, which required loading multiple vst3 plugins to process the sound collaboratively. It was necessary to display the control page of each vst3 plugin. After checking the code, I learned that the plugin page was displayed by calling the C++ code of the JUCE lib.
Problem description:
The loading plugin page plugin.show_editor can only be displayed in the main thread, the UI thread of the plugin created by multi-threading will be blocked. The code after self.plugin.show_editor() will only be executed when the plugin page is closed.
The plugin UI page cannot be dragged, minimized, or closed (PS: it can only be controlled by the window, without plugin UI page button control).
Loading multiple plugin pages will cause overlap(All displayed in the upper left corner). Refer to problem 2, and it is impossible to drag and drop for operation.
The following is the function of pedalboard-master/pedalboard/ExternalPlugin.h to display the plugin page. Can I modify this function to make the plugin page draggable, minimized, and closed?
/**
* Open a native window to show a given AudioProcessor's editor UI,
* pumping the juce::MessageManager run loop as necessary to service
* UI events.
*
* Check the passed threading.Event object every 10ms to close the
* window if necessary.
*/
static void openWindowAndWait(juce::AudioProcessor &processor,
py::object optionalEvent) {
bool shouldThrowErrorAlreadySet = false;
throw std::runtime_error("Failed to create plugin editor UI.");
// Check the provided Event object before even opening the window:
if (optionalEvent != py::none() &&
optionalEvent.attr("is_set")().cast<bool>()) {
return;
}
{
// Release the GIL to allow other Python threads to run in the
// background while we the UI is running:
py::gil_scoped_release release;
JUCE_AUTORELEASEPOOL {
StandalonePluginWindow window(processor);
window.show();
// Run in a tight loop so that we don't have to call
// ->stopDispatchLoop(), which causes the MessageManager to become
// unusable in the future. The window can be closed by sending a
// KeyboardInterrupt, closing the window in the UI, or setting the
// provided Event object.
while (window.isVisible()) {
bool errorThrown = false;
bool eventSet = false;
{
py::gil_scoped_acquire acquire;
errorThrown = PyErr_CheckSignals() != 0;
eventSet = optionalEvent != py::none() &&
optionalEvent.attr("is_set")().cast<bool>();
}
if (errorThrown || eventSet) {
window.closeButtonPressed();
shouldThrowErrorAlreadySet = errorThrown;
break;
}
juce::MessageManager::getInstance()->runDispatchLoopUntil(10);
}
}
// Once the Autorelease pool has been drained, pump the dispatch loop one
// more time to process any window close events:
juce::MessageManager::getInstance()->runDispatchLoopUntil(10);
}
if (shouldThrowErrorAlreadySet) {
throw py::error_already_set();
}
}
I encountered a requirement, which required loading multiple vst3 plugins to process the sound collaboratively. It was necessary to display the control page of each vst3 plugin. After checking the code, I learned that the plugin page was displayed by calling the C++ code of the JUCE lib. Problem description:
plugin.show_editor
can only be displayed in the main thread, the UI thread of the plugin created by multi-threading will be blocked. The code after self.plugin.show_editor() will only be executed when the plugin page is closed.The following is the function of pedalboard-master/pedalboard/ExternalPlugin.h to display the plugin page. Can I modify this function to make the plugin page draggable, minimized, and closed?