Browse Source

Cleanup memory of the VST plugin

tags/v2.3.0-RC1
falkTX 4 years ago
parent
commit
0c85fdb63f
1 changed files with 21 additions and 0 deletions
  1. +21
    -0
      source/plugin/carla-vst-export.cpp

+ 21
- 0
source/plugin/carla-vst-export.cpp View File

@@ -49,6 +49,24 @@ __cdecl static void cvst_processReplacingCallback(AEffect* effect, float** input
}
#endif

static struct CarlaVSTCleanup {
std::vector<AEffect*> effects;
std::vector<VstObject*> objects;

CarlaVSTCleanup()
: effects(),
objects() {}

~CarlaVSTCleanup()
{
for (std::vector<VstObject*>::iterator it=objects.begin(), end=objects.end(); it != end; ++it)
delete (*it);

for (std::vector<AEffect*>::iterator it=effects.begin(), end=effects.end(); it != end; ++it)
delete (*it);
}
} gCarlaVSTCleanup;

CARLA_EXPORT __cdecl
const AEffect* VSTPluginMain(audioMasterCallback audioMaster);

@@ -72,6 +90,9 @@ const AEffect* VSTPluginMain(audioMasterCallback audioMaster)
obj->plugin = nullptr;
effect->object = obj;

gCarlaVSTCleanup.effects.push_back(effect);
gCarlaVSTCleanup.objects.push_back(obj);

// static calls
#ifdef __WINE__
effect->dispatcher = cvst_dispatcherCallback;


Loading…
Cancel
Save