Browse Source

Carla-Discovery: Allow open&close VSTs to avoid memory leaks

tags/v0.9.0
falkTX 12 years ago
parent
commit
147833d8ae
2 changed files with 5 additions and 9 deletions
  1. +1
    -1
      c++/carla-discovery/Makefile.dbg
  2. +4
    -8
      c++/carla-discovery/carla-discovery.cpp

+ 1
- 1
c++/carla-discovery/Makefile.dbg View File

@@ -56,7 +56,7 @@ win64: carla-discovery-win64.exe
OBJS = carla-discovery.cpp OBJS = carla-discovery.cpp


carla-discovery-native: carla-discovery.cpp ../carla-lilv/carla_lilv.a carla-discovery-native: carla-discovery.cpp ../carla-lilv/carla_lilv.a
$(CXX) $^ $(BUILD_FLAGS) $(LINK_FLAGS) -o $@ && $(STRIP) $@
$(CXX) $^ $(BUILD_FLAGS) $(LINK_FLAGS) -o $@


carla-discovery-posix32: $(OBJS) ../carla-lilv/carla_lilv_posix32.a carla-discovery-posix32: $(OBJS) ../carla-lilv/carla_lilv_posix32.a
$(CXX) $^ $(POSIX_BUILD_FLAGS) $(POSIX_32BIT_FLAGS) $(POSIX_LINK_FLAGS) -o $@ $(CXX) $^ $(POSIX_BUILD_FLAGS) $(POSIX_32BIT_FLAGS) $(POSIX_LINK_FLAGS) -o $@


+ 4
- 8
c++/carla-discovery/carla-discovery.cpp View File

@@ -110,7 +110,7 @@ intptr_t vstHostCanDo(const char* const feature)
intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt) intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode, const int32_t index, const intptr_t value, void* const ptr, const float opt)
{ {
#if DEBUG #if DEBUG
qDebug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);
qDebug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);
#endif #endif


intptr_t ret = 0; intptr_t ret = 0;
@@ -196,7 +196,7 @@ intptr_t VSTCALLBACK vstHostCallback(AEffect* const effect, const int32_t opcode
break; break;


default: default:
qDebug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);
qDebug("vstHostCallback(%p, %s, %i, " P_INTPTR ", %p, %f)", effect, vstMasterOpcode2str(opcode), index, value, ptr, opt);
break; break;
} }


@@ -774,9 +774,7 @@ void do_vst_check(void* const libHandle, const bool init)
vstCurrentUniqueId = effect->uniqueID; vstCurrentUniqueId = effect->uniqueID;
intptr_t vstCategory = effect->dispatcher(effect, effGetPlugCategory, 0, 0, nullptr, 0.0f); intptr_t vstCategory = effect->dispatcher(effect, effGetPlugCategory, 0, 0, nullptr, 0.0f);


// only init if required
if (init || vstCategory == kPlugCategShell)
effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f);


while (true) while (true)
{ {
@@ -917,9 +915,7 @@ void do_vst_check(void* const libHandle, const bool init)
break; break;
} }


// only close if required
if (init || vstCategory == kPlugCategShell)
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effClose, 0, 0, nullptr, 0.0f);


free((void*)cName); free((void*)cName);
free((void*)cProduct); free((void*)cProduct);


Loading…
Cancel
Save