diff --git a/source/backend/Makefile.mk b/source/backend/Makefile.mk index 42d0da75e..067ccd47a 100644 --- a/source/backend/Makefile.mk +++ b/source/backend/Makefile.mk @@ -33,27 +33,3 @@ BUILD_CXX_FLAGS += -DWANT_LINUXSAMPLER endif # -------------------------------------------------------------- - -ifeq ($(HAVE_OPENGL),true) -BUILD_CXX_FLAGS += -DWANT_OPENGL -endif - -ifeq ($(HAVE_AF_DEPS),true) -BUILD_CXX_FLAGS += -DWANT_AUDIOFILE -ifeq ($(HAVE_FFMPEG),true) -BUILD_CXX_FLAGS += -DHAVE_FFMPEG -endif -endif - -ifeq ($(HAVE_MF_DEPS),true) -BUILD_CXX_FLAGS += -DWANT_MIDIFILE -endif - -ifeq ($(HAVE_ZYN_DEPS),true) -BUILD_CXX_FLAGS += -DWANT_ZYNADDSUBFX -ifeq ($(HAVE_ZYN_UI_DEPS),true) -BUILD_CXX_FLAGS += -DWANT_ZYNADDSUBFX_UI -endif -endif - -# -------------------------------------------------------------- diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 7717b1eee..fcb68873b 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -329,35 +329,30 @@ int32_t CarlaPlugin::getCurrentMidiProgram() const noexcept const ParameterData& CarlaPlugin::getParameterData(const uint32_t parameterId) const { CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, kParameterDataNull); - return pData->param.data[parameterId]; } const ParameterRanges& CarlaPlugin::getParameterRanges(const uint32_t parameterId) const { CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, kParameterRangesNull); - return pData->param.ranges[parameterId]; } bool CarlaPlugin::isParameterOutput(const uint32_t parameterId) const { CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count, false); - return (pData->param.data[parameterId].type == PARAMETER_OUTPUT); } const MidiProgramData& CarlaPlugin::getMidiProgramData(const uint32_t index) const { CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count, kMidiProgramDataNull); - return pData->midiprog.data[index]; } const CustomData& CarlaPlugin::getCustomData(const uint32_t index) const { CARLA_SAFE_ASSERT_RETURN(index < pData->custom.count(), kCustomDataNull); - return pData->custom.getAt(index); } @@ -450,7 +445,6 @@ void CarlaPlugin::getProgramName(const uint32_t index, char* const strBuf) const { CARLA_SAFE_ASSERT_RETURN(index < pData->prog.count,); CARLA_SAFE_ASSERT_RETURN(pData->prog.names[index] != nullptr,); - std::strncpy(strBuf, pData->prog.names[index], STR_MAX); } @@ -458,7 +452,6 @@ void CarlaPlugin::getMidiProgramName(const uint32_t index, char* const strBuf) c { CARLA_SAFE_ASSERT_RETURN(index < pData->midiprog.count,); CARLA_SAFE_ASSERT_RETURN(pData->midiprog.data[index].name != nullptr,); - std::strncpy(strBuf, pData->midiprog.data[index].name, STR_MAX); } @@ -881,7 +874,7 @@ void CarlaPlugin::setId(const unsigned int newId) noexcept void CarlaPlugin::setName(const char* const newName) { - CARLA_ASSERT(newName != nullptr); + CARLA_ASSERT(newName != nullptr && newName[0] != '\0'); fName = newName; } diff --git a/source/backend/plugin/DssiPlugin.cpp b/source/backend/plugin/DssiPlugin.cpp index b48e7ccf2..d35c35a69 100644 --- a/source/backend/plugin/DssiPlugin.cpp +++ b/source/backend/plugin/DssiPlugin.cpp @@ -280,8 +280,8 @@ public: { CARLA_SAFE_ASSERT_RETURN(fDssiDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); - CARLA_SAFE_ASSERT_RETURN(type != nullptr,); - CARLA_SAFE_ASSERT_RETURN(key != nullptr,); + CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0',); + CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); CARLA_SAFE_ASSERT_RETURN(value != nullptr,); carla_debug("DssiPlugin::setCustomData(%s, %s, %s, %s)", type, key, value, bool2str(sendGui)); diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 1fb9183fd..8ccd20b6e 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -21,106 +21,6 @@ #include "CarlaNative.h" -extern "C" { - -// Simple plugins -void carla_register_native_plugin_bypass(); -void carla_register_native_plugin_lfo(); -void carla_register_native_plugin_midiGain(); -void carla_register_native_plugin_midiSplit(); -void carla_register_native_plugin_midiThrough(); -void carla_register_native_plugin_midiTranspose(); -void carla_register_native_plugin_nekofilter(); -void carla_register_native_plugin_sunvoxfile(); -void carla_register_native_plugin_vex_fx(); -void carla_register_native_plugin_vex_synth(); - -#ifndef BUILD_BRIDGE -// Carla -void carla_register_native_plugin_carla(); -#endif - -#ifdef WANT_AUDIOFILE -// AudioFile -void carla_register_native_plugin_audiofile(); -#endif - -#ifdef WANT_MIDIFILE -// MidiFile -void carla_register_native_plugin_midifile(); -#endif - -#ifdef WANT_OPENGL -// DISTRHO plugins (OpenGL) -void carla_register_native_plugin_3BandEQ(); -void carla_register_native_plugin_3BandSplitter(); -void carla_register_native_plugin_Nekobi(); -void carla_register_native_plugin_PingPongPan(); -//void carla_register_native_plugin_StereoEnhancer(); -#endif - -// DISTRHO plugins (PyQt) -void carla_register_native_plugin_BigMeter(); -void carla_register_native_plugin_BigMeterM(); -void carla_register_native_plugin_Notes(); - -#ifdef WANT_ZYNADDSUBFX -// ZynAddSubFX -void carla_register_native_plugin_zynaddsubfx_fx(); -void carla_register_native_plugin_zynaddsubfx_synth(); -#endif -} - -void carla_register_all_plugins() -{ - // Simple plugins - carla_register_native_plugin_bypass(); - carla_register_native_plugin_lfo(); - carla_register_native_plugin_midiGain(); - carla_register_native_plugin_midiSplit(); - carla_register_native_plugin_midiThrough(); - carla_register_native_plugin_midiTranspose(); - carla_register_native_plugin_nekofilter(); - //carla_register_native_plugin_sunvoxfile(); // unfinished - carla_register_native_plugin_vex_fx(); - carla_register_native_plugin_vex_synth(); - -#ifndef BUILD_BRIDGE - // Carla - //carla_register_native_plugin_carla(); // kinda unfinished -#endif - -#ifdef WANT_AUDIOFILE - // AudioFile - carla_register_native_plugin_audiofile(); -#endif - -#ifdef WANT_MIDIFILE - // MidiFile - carla_register_native_plugin_midifile(); -#endif - -#ifdef WANT_OPENGL - // DISTRHO plugins (OpenGL) - carla_register_native_plugin_3BandEQ(); - carla_register_native_plugin_3BandSplitter(); - carla_register_native_plugin_Nekobi(); - carla_register_native_plugin_PingPongPan(); - //carla_register_native_plugin_StereoEnhancer(); // unfinished -#endif - - // DISTRHO plugins (PyQt) - carla_register_native_plugin_BigMeter(); - carla_register_native_plugin_BigMeterM(); - carla_register_native_plugin_Notes(); - -#ifdef WANT_ZYNADDSUBFX - // ZynAddSubFX - carla_register_native_plugin_zynaddsubfx_fx(); - carla_register_native_plugin_zynaddsubfx_synth(); -#endif -} - CARLA_BACKEND_START_NAMESPACE #if 0 @@ -215,19 +115,11 @@ public: fIsUiVisible(false), fAudioInBuffers(nullptr), fAudioOutBuffers(nullptr), -#ifdef CARLA_PROPER_CPP11_SUPPORT - fMidiEventCount(0), - fCurMidiProgs{0} -#else fMidiEventCount(0) -#endif { carla_debug("NativePlugin::NativePlugin(%p, %i)", engine, id); -#ifndef CARLA_PROPER_CPP11_SUPPORT carla_fill(fCurMidiProgs, MAX_MIDI_CHANNELS, 0); -#endif - carla_zeroStruct< ::MidiEvent>(fMidiEvents, kPluginMaxMidiEvents*2); carla_zeroStruct< ::TimeInfo>(fTimeInfo); @@ -409,8 +301,8 @@ public: if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) { - const ParameterScalePoint& scalePoint(param->scalePoints[scalePointId]); - return scalePoint.value; + const ParameterScalePoint* scalePoint(¶m->scalePoints[scalePointId]); + return scalePoint->value; } carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__); @@ -460,84 +352,89 @@ public: void getParameterName(const uint32_t parameterId, char* const strBuf) const override { CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); - CARLA_ASSERT(fHandle != nullptr); - CARLA_ASSERT(parameterId < pData->param.count); + CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,); + CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); + CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); - if (fDescriptor->get_parameter_info != nullptr && parameterId < pData->param.count) + if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) { - const Parameter* const param(fDescriptor->get_parameter_info(fHandle, parameterId)); - - if (param != nullptr && param->name != nullptr) + if (param->name != nullptr) { std::strncpy(strBuf, param->name, STR_MAX); return; } + carla_assert("param->name != nullptr", __FILE__, __LINE__); + return CarlaPlugin::getParameterName(parameterId, strBuf); } + carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__); CarlaPlugin::getParameterName(parameterId, strBuf); } void getParameterText(const uint32_t parameterId, char* const strBuf) const override { CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); - CARLA_ASSERT(fHandle != nullptr); - CARLA_ASSERT(parameterId < pData->param.count); + CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_text != nullptr,); + CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_value != nullptr,); + CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); + CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); - if (fDescriptor->get_parameter_value != nullptr && fDescriptor->get_parameter_text != nullptr && parameterId < pData->param.count) - { - const float value(fDescriptor->get_parameter_value(fHandle, parameterId)); + const float value(fDescriptor->get_parameter_value(fHandle, parameterId)); - if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)) - { - std::strncpy(strBuf, text, STR_MAX); - return; - } + if (const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)) + { + std::strncpy(strBuf, text, STR_MAX); + return; } + carla_assert("const char* const text = fDescriptor->get_parameter_text(fHandle, parameterId, value)", __FILE__, __LINE__); CarlaPlugin::getParameterText(parameterId, strBuf); } void getParameterUnit(const uint32_t parameterId, char* const strBuf) const override { CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); - CARLA_ASSERT(fHandle != nullptr); - CARLA_ASSERT(parameterId < pData->param.count); + CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,); + CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); + CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); - if (fDescriptor->get_parameter_info != nullptr && parameterId < pData->param.count) + if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) { - const Parameter* const param(fDescriptor->get_parameter_info(fHandle, parameterId)); - - if (param != nullptr && param->unit != nullptr) + if (param->unit != nullptr) { std::strncpy(strBuf, param->unit, STR_MAX); return; } + carla_assert("param->unit != nullptr", __FILE__, __LINE__); + return CarlaPlugin::getParameterUnit(parameterId, strBuf); } + carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__); CarlaPlugin::getParameterUnit(parameterId, strBuf); } void getParameterScalePointLabel(const uint32_t parameterId, const uint32_t scalePointId, char* const strBuf) const override { CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); - CARLA_ASSERT(fHandle != nullptr); - CARLA_ASSERT(parameterId < pData->param.count); - CARLA_ASSERT(scalePointId < getParameterScalePointCount(parameterId)); + CARLA_SAFE_ASSERT_RETURN(fDescriptor->get_parameter_info != nullptr,); + CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); + CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); + CARLA_SAFE_ASSERT_RETURN(scalePointId < getParameterScalePointCount(parameterId),); - if (fDescriptor->get_parameter_info != nullptr && parameterId < pData->param.count) + if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) { - if (const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)) - { - const ParameterScalePoint& scalePoint(param->scalePoints[scalePointId]); + const ParameterScalePoint* scalePoint(¶m->scalePoints[scalePointId]); - if (scalePoint.label != nullptr) - { - std::strncpy(strBuf, scalePoint.label, STR_MAX); - return; - } + if (scalePoint->label != nullptr) + { + std::strncpy(strBuf, scalePoint->label, STR_MAX); + return; } + carla_assert("scalePoint->label != nullptr", __FILE__, __LINE__); + return CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf); } + carla_assert("const Parameter* const param = fDescriptor->get_parameter_info(fHandle, parameterId)", __FILE__, __LINE__); CarlaPlugin::getParameterScalePointLabel(parameterId, scalePointId, strBuf); } @@ -609,18 +506,16 @@ public: void setParameterValue(const uint32_t parameterId, const float value, const bool sendGui, const bool sendOsc, const bool sendCallback) override { CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); + CARLA_SAFE_ASSERT_RETURN(fDescriptor->set_parameter_value != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); - CARLA_ASSERT(parameterId < pData->param.count); + CARLA_SAFE_ASSERT_RETURN(parameterId < pData->param.count,); const float fixedValue(pData->param.getFixedValue(parameterId, value)); - if (fDescriptor->set_parameter_value != nullptr && parameterId < pData->param.count) - { - fDescriptor->set_parameter_value(fHandle, parameterId, fixedValue); + fDescriptor->set_parameter_value(fHandle, parameterId, fixedValue); - if (fHandle2 != nullptr) - fDescriptor->set_parameter_value(fHandle2, parameterId, fixedValue); - } + if (fHandle2 != nullptr) + fDescriptor->set_parameter_value(fHandle2, parameterId, fixedValue); CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); } @@ -629,23 +524,14 @@ public: { CARLA_SAFE_ASSERT_RETURN(fDescriptor != nullptr,); CARLA_SAFE_ASSERT_RETURN(fHandle != nullptr,); - CARLA_ASSERT(type != nullptr); - CARLA_ASSERT(key != nullptr); - CARLA_ASSERT(value != nullptr); + CARLA_SAFE_ASSERT_RETURN(type != nullptr && type[0] != '\0',); + CARLA_SAFE_ASSERT_RETURN(key != nullptr && key[0] != '\0',); + CARLA_SAFE_ASSERT_RETURN(value != nullptr,); carla_debug("NativePlugin::setCustomData(%s, %s, %s, %s)", type, key, value, bool2str(sendGui)); - if (type == nullptr) - return carla_stderr2("NativePlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is null", type, key, value, bool2str(sendGui)); - if (std::strcmp(type, CUSTOM_DATA_STRING) != 0 && std::strcmp(type, CUSTOM_DATA_CHUNK) != 0) return carla_stderr2("NativePlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - type is invalid", type, key, value, bool2str(sendGui)); - if (key == nullptr) - return carla_stderr2("NativePlugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - key is null", type, key, value, bool2str(sendGui)); - - if (value == nullptr) - return carla_stderr2("Nativelugin::setCustomData(\"%s\", \"%s\", \"%s\", %s) - value is null", type, key, value, bool2str(sendGui)); - if (std::strcmp(type, CUSTOM_DATA_CHUNK) == 0) { if (fDescriptor->set_state != nullptr && (fDescriptor->hints & ::PLUGIN_USES_STATE) != 0) diff --git a/source/modules/CarlaNative.h b/source/modules/CarlaNative.h index ec5d8ae08..ffc274ce5 100644 --- a/source/modules/CarlaNative.h +++ b/source/modules/CarlaNative.h @@ -259,8 +259,12 @@ typedef struct _PluginDescriptor { // ----------------------------------------------------------------------- // Register plugin +// Implemented by host extern void carla_register_native_plugin(const PluginDescriptor* desc); +// Called once on host init +void carla_register_all_plugins(); + // ----------------------------------------------------------------------- /**@}*/ diff --git a/source/modules/carla_native/Makefile b/source/modules/carla_native/Makefile index a9d6be817..524a6a5db 100644 --- a/source/modules/carla_native/Makefile +++ b/source/modules/carla_native/Makefile @@ -24,10 +24,17 @@ LINK_FLAGS += -ljuce_gui_basics $(JUCE_GUI_BASICS_LIBS) # -------------------------------------------------------------- +ALL_C_FLAGS = $(BUILD_C_FLAGS) + +ifeq ($(HAVE_OPENGL),true) +ALL_C_FLAGS += -DWANT_OPENGL +endif + ifeq ($(HAVE_AF_DEPS),true) AF_C_FLAGS = $(BUILD_C_FLAGS) AF_C_FLAGS += $(shell pkg-config --cflags sndfile) LINK_FLAGS += $(shell pkg-config --libs sndfile) +ALL_C_FLAGS += -DWANT_AUDIOFILE ifeq ($(HAVE_FFMPEG),true) AF_C_FLAGS += -DHAVE_FFMPEG AF_C_FLAGS += $(shell pkg-config --cflags libavcodec libavformat libavutil) @@ -39,6 +46,7 @@ ifeq ($(HAVE_MF_DEPS),true) MF_CXX_FLAGS = $(BUILD_CXX_FLAGS) MF_CXX_FLAGS += $(shell pkg-config --cflags smf) LINK_FLAGS += $(shell pkg-config --libs smf) +ALL_C_FLAGS += -DWANT_MIDIFILE endif ifeq ($(HAVE_ZYN_DEPS),true) @@ -50,6 +58,7 @@ ZYN_CXX_FLAGS += -DNTK_GUI -DWANT_ZYNADDSUBFX_UI ZYN_CXX_FLAGS += $(shell pkg-config --cflags ntk_images ntk) LINK_FLAGS += $(shell pkg-config --libs ntk_images ntk) endif +ALL_C_FLAGS += -DWANT_ZYNADDSUBFX endif # Implement carla_register_native_plugin @@ -57,8 +66,10 @@ LINK_FLAGS += -I.. _link.c # -------------------------------------------------------------- +OBJS = _all.c.o + # Simple plugins (C) -OBJS = \ +OBJS += \ bypass.c.o \ lfo.c.o \ midi-gain.c.o \ @@ -179,6 +190,9 @@ CXXDEPS = ../CarlaNative.h ../CarlaNative.hpp %.c.o: %.c $(CC) $< $(BUILD_C_FLAGS) -c -o $@ +_all.c.o: _all.c $(CDEPS) + $(CC) $< $(ALL_C_FLAGS) -c -o $@ + audio_decoder/%.c.o: audio_decoder/%.c $(CC) $< $(AF_C_FLAGS) -c -o $@ @@ -224,6 +238,9 @@ vex-%.cpp.o: vex-%.cpp zynaddsubfx-%.cpp.o: zynaddsubfx-%.cpp $(CXXDEPS) $(ZYN_UI_FILES_H) $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ +zynaddsubfx-src.cpp.o: zynaddsubfx-src.cpp $(ZYN_UI_FILES_H) + $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ + zynaddsubfx-ui.cpp.o: zynaddsubfx-ui.cpp $(ZYN_UI_FILES_H) $(ZYN_UI_FILES_CPP) $(CXX) $< $(ZYN_CXX_FLAGS) -c -o $@ diff --git a/source/modules/carla_native/_all.c b/source/modules/carla_native/_all.c new file mode 100644 index 000000000..967ad3435 --- /dev/null +++ b/source/modules/carla_native/_all.c @@ -0,0 +1,115 @@ +/* + * Carla Native Plugins + * Copyright (C) 2013 Filipe Coelho + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * For a full copy of the GNU General Public License see the doc/GPL.txt file. + */ + +#include "CarlaNative.h" + +// Simple plugins +extern void carla_register_native_plugin_bypass(); +extern void carla_register_native_plugin_lfo(); +extern void carla_register_native_plugin_midiGain(); +extern void carla_register_native_plugin_midiSplit(); +extern void carla_register_native_plugin_midiThrough(); +extern void carla_register_native_plugin_midiTranspose(); +extern void carla_register_native_plugin_nekofilter(); + +// Simple plugins (C++) +extern void carla_register_native_plugin_sunvoxfile(); +extern void carla_register_native_plugin_vex_fx(); +extern void carla_register_native_plugin_vex_synth(); + +// Carla +extern void carla_register_native_plugin_carla(); + +#ifdef WANT_AUDIOFILE +// AudioFile +extern void carla_register_native_plugin_audiofile(); +#endif + +#ifdef WANT_MIDIFILE +// MidiFile +extern void carla_register_native_plugin_midifile(); +#endif + +#ifdef WANT_OPENGL +// DISTRHO plugins (OpenGL) +extern void carla_register_native_plugin_3BandEQ(); +extern void carla_register_native_plugin_3BandSplitter(); +extern void carla_register_native_plugin_Nekobi(); +extern void carla_register_native_plugin_PingPongPan(); +extern void carla_register_native_plugin_StereoEnhancer(); +#endif + +// DISTRHO plugins (PyQt) +extern void carla_register_native_plugin_BigMeter(); +extern void carla_register_native_plugin_BigMeterM(); +extern void carla_register_native_plugin_Notes(); + +#ifdef WANT_ZYNADDSUBFX +// ZynAddSubFX +extern void carla_register_native_plugin_zynaddsubfx_fx(); +extern void carla_register_native_plugin_zynaddsubfx_synth(); +#endif + +void carla_register_all_plugins() +{ + // Simple plugins + carla_register_native_plugin_bypass(); + carla_register_native_plugin_lfo(); + carla_register_native_plugin_midiGain(); + carla_register_native_plugin_midiSplit(); + carla_register_native_plugin_midiThrough(); + carla_register_native_plugin_midiTranspose(); + carla_register_native_plugin_nekofilter(); + + // Simple plugins (C++) + //carla_register_native_plugin_sunvoxfile(); // unfinished + carla_register_native_plugin_vex_fx(); + carla_register_native_plugin_vex_synth(); + + // Carla + //carla_register_native_plugin_carla(); // kinda unfinished + +#ifdef WANT_AUDIOFILE + // AudioFile + carla_register_native_plugin_audiofile(); +#endif + +#ifdef WANT_MIDIFILE + // MidiFile + carla_register_native_plugin_midifile(); +#endif + +#ifdef WANT_OPENGL + // DISTRHO plugins (OpenGL) + carla_register_native_plugin_3BandEQ(); + carla_register_native_plugin_3BandSplitter(); + carla_register_native_plugin_Nekobi(); + carla_register_native_plugin_PingPongPan(); + //carla_register_native_plugin_StereoEnhancer(); // unfinished +#endif + + // DISTRHO plugins (PyQt) + carla_register_native_plugin_BigMeter(); + carla_register_native_plugin_BigMeterM(); + carla_register_native_plugin_Notes(); + +#ifdef WANT_ZYNADDSUBFX + // ZynAddSubFX + carla_register_native_plugin_zynaddsubfx_fx(); + carla_register_native_plugin_zynaddsubfx_synth(); +#endif +} diff --git a/source/plugin/carla-native-base.cpp b/source/plugin/carla-native-base.cpp index 988790be7..613c59d61 100644 --- a/source/plugin/carla-native-base.cpp +++ b/source/plugin/carla-native-base.cpp @@ -20,103 +20,13 @@ #include "lv2/lv2.h" -// ----------------------------------------------------------------------- -// Plugin register calls - -extern "C" { - -// Simple plugins (C) -void carla_register_native_plugin_bypass(); -void carla_register_native_plugin_lfo(); -void carla_register_native_plugin_midiGain(); -void carla_register_native_plugin_midiSplit(); -void carla_register_native_plugin_midiThrough(); -void carla_register_native_plugin_midiTranspose(); -void carla_register_native_plugin_nekofilter(); - -// Simple plugins (C++) -void carla_register_native_plugin_vex_fx(); -void carla_register_native_plugin_vex_synth(); - -#ifdef WANT_AUDIOFILE -// AudioFile -void carla_register_native_plugin_audiofile(); -#endif - -#ifdef WANT_MIDIFILE -// MidiFile -void carla_register_native_plugin_midifile(); -#endif - -#ifdef WANT_OPENGL -// DISTRHO plugins (OpenGL) -void carla_register_native_plugin_3BandEQ(); -void carla_register_native_plugin_3BandSplitter(); -void carla_register_native_plugin_Nekobi(); -void carla_register_native_plugin_PingPongPan(); -// void carla_register_native_plugin_StereoEnhancer(); -#endif - -// DISTRHO plugins (PyQt) -void carla_register_native_plugin_BigMeter(); -void carla_register_native_plugin_BigMeterM(); -void carla_register_native_plugin_Notes(); - -#ifdef WANT_ZYNADDSUBFX -// ZynAddSubFX -void carla_register_native_plugin_zynaddsubfx_fx(); -void carla_register_native_plugin_zynaddsubfx_synth(); -#endif -} - // ----------------------------------------------------------------------- // Plugin List struct PluginListManager { PluginListManager() { - // Simple plugins (C) - carla_register_native_plugin_bypass(); - carla_register_native_plugin_lfo(); - carla_register_native_plugin_midiGain(); - carla_register_native_plugin_midiSplit(); - carla_register_native_plugin_midiThrough(); - carla_register_native_plugin_midiTranspose(); - carla_register_native_plugin_nekofilter(); - - // Simple plugins (C++) - carla_register_native_plugin_vex_fx(); - carla_register_native_plugin_vex_synth(); - -#ifdef WANT_AUDIOFILE - // AudioFile - carla_register_native_plugin_audiofile(); -#endif - -#ifdef WANT_MIDIFILE - // MidiFile - carla_register_native_plugin_midifile(); -#endif - -#ifdef WANT_OPENGL - // DISTRHO plugins (OpenGL) - carla_register_native_plugin_3BandEQ(); - carla_register_native_plugin_3BandSplitter(); - carla_register_native_plugin_Nekobi(); - carla_register_native_plugin_PingPongPan(); - //carla_register_native_plugin_StereoEnhancer(); // unfinished -#endif - - // DISTRHO plugins (PyQt) - carla_register_native_plugin_BigMeter(); - carla_register_native_plugin_BigMeterM(); - carla_register_native_plugin_Notes(); // unfinished - -#ifdef WANT_ZYNADDSUBFX - // ZynAddSubFX - carla_register_native_plugin_zynaddsubfx_fx(); - carla_register_native_plugin_zynaddsubfx_synth(); -#endif + carla_register_all_plugins(); } ~PluginListManager() @@ -138,6 +48,8 @@ struct PluginListManager { static PluginListManager sPluginDescsMgr; +// ----------------------------------------------------------------------- + void carla_register_native_plugin(const PluginDescriptor* desc) { #ifdef CARLA_NATIVE_PLUGIN_LV2