From 96e56c02d4df0c6b57ed5b4336a84a6ca0f03d0b Mon Sep 17 00:00:00 2001 From: falkTX Date: Fri, 25 Sep 2020 03:38:51 +0100 Subject: [PATCH] Load and test all internal plugins --- source/tests/Makefile | 3 ++- source/tests/carla-host-plugin.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/source/tests/Makefile b/source/tests/Makefile index 3bc3a568d..5c05b9a04 100644 --- a/source/tests/Makefile +++ b/source/tests/Makefile @@ -87,6 +87,7 @@ ansi-%_run: $(BINDIR)/ansi-% $(BINDIR)/ansi-$* carla-%_run: $(BINDIR)/carla-% +# valgrind $(BINDIR)/carla-$* valgrind --leak-check=full --show-leak-kinds=all --suppressions=valgrind.supp $(BINDIR)/carla-$* # --------------------------------------------------------------------------------------------------------------------- @@ -120,7 +121,7 @@ $(BINDIR)/ansi-pedantic-test_cxx11: ansi-pedantic-test.cpp ../backend/Carla*.h . # --------------------------------------------------------------------------------------------------------------------- $(BINDIR)/carla-host-plugin: carla-host-plugin.c - $(CC) $< $(PEDANTIC_CFLAGS) $(PEDANTIC_LDFLAGS) -Wno-declaration-after-statement -Wno-pedantic -lcarla_host-plugin -ansi -o $@ + $(CC) $< $(PEDANTIC_CFLAGS) $(PEDANTIC_LDFLAGS) -g -O0 -Wno-declaration-after-statement -Wno-pedantic -lcarla_host-plugin -std=c99 -o $@ # --------------------------------------------------------------------------------------------------------------------- diff --git a/source/tests/carla-host-plugin.c b/source/tests/carla-host-plugin.c index 81437067f..eaa7bfc4d 100644 --- a/source/tests/carla-host-plugin.c +++ b/source/tests/carla-host-plugin.c @@ -18,6 +18,7 @@ #include "CarlaNativePlugin.h" #include +#include static uint32_t get_buffer_size(NativeHostHandle h) { @@ -78,8 +79,8 @@ int main(void) const char* const utils_folder = carla_utils_get_library_folder(); assert(utils_folder != NULL && utils_folder[0] != '\0'); -/* - carla_juce_init();*/ + + carla_juce_init(); const NativePluginDescriptor* const rack = carla_get_native_rack_plugin(); assert(rack != NULL); @@ -99,12 +100,33 @@ int main(void) const CarlaHostHandle patchbay_host_handle = carla_create_native_plugin_host_handle(patchbay, patchbay_handle); assert(patchbay_host_handle); + uint32_t plugins_count = 0; + const NativePluginDescriptor* const plugin_descriptors = carla_get_native_plugins_data(&plugins_count); + assert(plugins_count != 0); + assert(plugin_descriptors != NULL); + + for (uint32_t i=0; ilabel != NULL); + + printf("Loading plugin #%u '%s'\n", i+1, plugin_descriptor->label); + + if ((plugin_descriptor->hints & NATIVE_PLUGIN_USES_CONTROL_VOLTAGE) == 0x0) { + assert(carla_add_plugin(rack_host_handle, BINARY_NATIVE, PLUGIN_INTERNAL, "", "", plugin_descriptor->label, 0, NULL, 0x0)); + } + + if (plugin_descriptor->midiIns <= 1 && plugin_descriptor->midiOuts <= 1) { + assert(carla_add_plugin(patchbay_host_handle, BINARY_NATIVE, PLUGIN_INTERNAL, "", "", plugin_descriptor->label, 0, NULL, 0x0)); + } + } + rack->cleanup(patchbay_handle); rack->cleanup(rack_handle); carla_host_handle_free(patchbay_host_handle); carla_host_handle_free(rack_host_handle); - /* - carla_juce_cleanup();*/ + + carla_juce_cleanup(); return 0; }