Revert "VST2: Consolidate support methods (close, unload)"

This reverts commit 5e54425a35.

This is not compatible with current 6.x vst-info-file.
This commit is contained in:
Robin Gareus 2021-06-30 00:22:17 +02:00
parent a36ab0c562
commit 4170482aaf
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04
2 changed files with 45 additions and 23 deletions

View file

@ -267,7 +267,6 @@ vstfx_unload (VSTHandle* fhandle)
if (fhandle->name)
{
free (fhandle->name);
fhandle->name = 0;
}
/*Don't need the plugin handle any more*/
@ -340,19 +339,30 @@ void vstfx_close (VSTState* vstfx)
vstfx->plugin->dispatcher (vstfx->plugin, effClose, 0, 0, 0, 0);
}
if (vstfx->handle->plugincnt) {
if (vstfx->handle->plugincnt)
vstfx->handle->plugincnt--;
/*vstfx_unload will unload the dll if the instance count allows -
we need to do this because some plugins keep their own instance count
and (JUCE) manages the plugin UI in its own thread. When the plugins
internal instance count reaches zero, JUCE stops the UI thread and won't
restart it until the next time the library is loaded. If we don't unload
the lib JUCE will never restart*/
if (vstfx->handle->plugincnt)
{
return;
}
/* vstfx_unload will unload the dll if the instance count allows -
* we need to do this because some plugins keep their own instance count
* and (JUCE) manages the plugin UI in its own thread. When the plugins
* internal instance count reaches zero, JUCE stops the UI thread and won't
* restart it until the next time the library is loaded. If we don't unload
* the lib JUCE will never restart
*/
vstfx_unload (vstfx->handle);
/*Valid plugin loaded - so we can unload it and 0 the pointer
to it. We can't free the handle here because we don't know what else
might need it. It should be / is freed when the plugin is deleted*/
if (vstfx->handle->dll)
{
dlclose(vstfx->handle->dll); //dlclose keeps its own reference count
vstfx->handle->dll = 0;
}
free(vstfx);
}

View file

@ -141,7 +141,9 @@ mac_vst_unload (VSTHandle* fhandle)
{
if (fhandle->plugincnt)
{
/*Still have plugin instances - can't unload the library */
/*Still have plugin instances - can't unload the library
- actually dlclose keeps an instance count anyway*/
return -1;
}
@ -157,7 +159,6 @@ mac_vst_unload (VSTHandle* fhandle)
if (fhandle->name)
{
free (fhandle->name);
fhandle->name = 0;
}
/*Don't need the plugin handle any more*/
@ -233,20 +234,31 @@ void mac_vst_close (VSTState* mac_vst)
mac_vst->plugin->dispatcher (mac_vst->plugin, effClose, 0, 0, 0, 0);
}
if (mac_vst->handle->plugincnt) {
if (mac_vst->handle->plugincnt)
mac_vst->handle->plugincnt--;
/*mac_vst_unload will unload the dll if the instance count allows -
we need to do this because some plugins keep their own instance count
and (JUCE) manages the plugin UI in its own thread. When the plugins
internal instance count reaches zero, JUCE stops the UI thread and won't
restart it until the next time the library is loaded. If we don't unload
the lib JUCE will never restart*/
if (mac_vst->handle->plugincnt)
{
return;
}
/* mac_vst_unload will unload the dll if the instance count allows -
* we need to do this because some plugins keep their own instance count
* and (JUCE) manages the plugin UI in its own thread. When the plugins
* internal instance count reaches zero, JUCE stops the UI thread and won't
* restart it until the next time the library is loaded. If we don't unload
* the lib JUCE will never restart
*/
mac_vst_unload (mac_vst->handle);
/*Valid plugin loaded - so we can unload it and 0 the pointer
to it. We can't free the handle here because we don't know what else
might need it. It should be / is freed when the plugin is deleted*/
if (mac_vst->handle->dll)
{
dlclose (mac_vst->handle->dll); //dlclose keeps its own reference count
mac_vst->handle->dll = 0;
}
free (mac_vst);
}