Browse Source

Get rid of JUCE for discovery and utils

Signed-off-by: falkTX <falktx@falktx.com>
pull/1658/merge
falkTX 1 year ago
parent
commit
0b250a0cb7
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
13 changed files with 103 additions and 535 deletions
  1. +7
    -33
      source/backend/CarlaUtils.h
  2. +27
    -1
      source/backend/plugin/CarlaPluginJuce.cpp
  3. +2
    -94
      source/backend/utils/CachedPlugins.cpp
  4. +6
    -32
      source/backend/utils/Information.cpp
  5. +8
    -22
      source/backend/utils/JUCE.cpp
  6. +4
    -26
      source/backend/utils/Makefile
  7. +7
    -17
      source/backend/utils/PluginDiscovery.cpp
  8. +0
    -32
      source/discovery/Makefile
  9. +4
    -209
      source/discovery/carla-discovery.cpp
  10. +6
    -16
      source/frontend/CarlaFrontend.h
  11. +0
    -25
      source/frontend/carla_utils.py
  12. +29
    -21
      source/frontend/pluginlist/pluginlistdialog.cpp
  13. +3
    -7
      source/frontend/pluginlist/pluginlistdialog.hpp

+ 7
- 33
source/backend/CarlaUtils.h View File

@@ -1,19 +1,5 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
*
* 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.
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#ifndef CARLA_UTILS_H_INCLUDED
#define CARLA_UTILS_H_INCLUDED
@@ -341,19 +327,13 @@ typedef struct _CarlaCachedPluginInfo {

/*!
* Get how many cached plugins are available.
* Internal and LV2 plugin formats are cached and need to be discovered via this function.
* Internal, LV2 and SFZ plugin formats are cached and can be discovered via this function.
* Do not call this for any other plugin formats.
*
* @note if this carla build uses JUCE, then you must call carla_juce_init beforehand
* @note for AU plugins, you cannot call this outside the main thread
*/
CARLA_PLUGIN_EXPORT uint carla_get_cached_plugin_count(PluginType ptype, const char* pluginPath);

/*!
* Get information about a cached plugin.
*
* @note if this carla build uses JUCE, then you must call carla_juce_init beforehand
* @note for AU plugins, you cannot call this outside the main thread
*/
CARLA_PLUGIN_EXPORT const CarlaCachedPluginInfo* carla_get_cached_plugin_info(PluginType ptype, uint index);

@@ -368,7 +348,7 @@ CARLA_PLUGIN_EXPORT const CarlaCachedPluginInfo* carla_get_cached_plugin_info(Pl
CARLA_PLUGIN_EXPORT const char* carla_get_complete_license_text(void);

/*!
* Get the juce version used in the current Carla build.
* @deprecated do not use
*/
CARLA_PLUGIN_EXPORT const char* carla_get_juce_version(void);

@@ -397,23 +377,17 @@ CARLA_PLUGIN_EXPORT const char* carla_get_library_folder(void);
* JUCE */

/*!
* Initialize data structures and GUI support for JUCE.
* This is only needed when carla builds use JUCE and you call cached-plugin related APIs.
*
* Idle must then be called at somewhat regular intervals, though in practice there is no reason for it yet.
*
* Make sure to call carla_juce_cleanup after you are done with APIs that need JUCE.
* @deprecated do not use
*/
CARLA_PLUGIN_EXPORT void carla_juce_init(void);

/*!
* Give idle time to JUCE stuff.
* Currently only used for Linux.
* @deprecated do not use
*/
CARLA_PLUGIN_EXPORT void carla_juce_idle(void);

/*!
* Cleanup the JUCE stuff that was initialized by carla_juce_init.
* @deprecated do not use
*/
CARLA_PLUGIN_EXPORT void carla_juce_cleanup(void);



+ 27
- 1
source/backend/plugin/CarlaPluginJuce.cpp View File

@@ -1642,7 +1642,33 @@ public:

if (std::strcmp(format, "AU") == 0)
{
fileOrIdentifier = label;
// compat with new scanning
if (std::strlen(label) == 14 && label[4] == ',' && label[9] == ',')
{
fileOrIdentifier = "AudioUnit:";

/**/ if (std::strncmp(label, "aumu", 4) == 0)
fileOrIdentifier += "Synths/";
else if (std::strncmp(label, "aumf", 4) == 0)
fileOrIdentifier += "Effects/";
else if (std::strncmp(label, "aufx", 4) == 0)
fileOrIdentifier += "Effects/";
else if (std::strncmp(label, "augn", 4) == 0)
fileOrIdentifier += "Generators/";
else if (std::strncmp(label, "aupn", 4) == 0)
fileOrIdentifier += "Panners/";
else if (std::strncmp(label, "aumx", 4) == 0)
fileOrIdentifier += "Mixers/";
else if (std::strncmp(label, "aumi", 4) == 0)
fileOrIdentifier += "MidiEffects/";

fileOrIdentifier += label;
}
// old style label
else
{
fileOrIdentifier = label;
}
}
else
{


+ 2
- 94
source/backend/utils/CachedPlugins.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
*
* 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.
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaUtils.h"

@@ -22,11 +8,6 @@
#include "CarlaBackendUtils.hpp"
#include "CarlaLv2Utils.hpp"

#if defined(USING_JUCE) && defined(CARLA_OS_MAC)
# include "AppConfig.h"
# include "juce_audio_processors/juce_audio_processors.h"
#endif

#ifndef STATIC_PLUGIN_TARGET
# define HAVE_SFZ
# include "water/containers/Array.h"
@@ -603,67 +584,6 @@ static const CarlaCachedPluginInfo* get_cached_plugin_lv2(Lv2WorldClass& lv2Worl

// -------------------------------------------------------------------------------------------------------------------

#if defined(USING_JUCE) && defined(CARLA_OS_MAC)
static juce::StringArray gCachedAuPluginResults;

static void findAUs()
{
if (gCachedAuPluginResults.size() != 0)
return;

juce::AudioUnitPluginFormat auFormat;
gCachedAuPluginResults = auFormat.searchPathsForPlugins(juce::FileSearchPath(), false, false);
}

static const CarlaCachedPluginInfo* get_cached_plugin_au(const juce::String pluginId)
{
static CarlaCachedPluginInfo info;
static CarlaString sname, slabel, smaker;

info.valid = false;

juce::AudioUnitPluginFormat auFormat;
juce::OwnedArray<juce::PluginDescription> results;
auFormat.findAllTypesForFile(results, pluginId);
CARLA_SAFE_ASSERT_RETURN(results.size() > 0, &info);
CARLA_SAFE_ASSERT(results.size() == 1);

juce::PluginDescription* const desc(results[0]);
CARLA_SAFE_ASSERT_RETURN(desc != nullptr, &info);

info.category = CB::getPluginCategoryFromName(desc->category.toRawUTF8());
info.hints = 0x0;
info.valid = true;

if (desc->isInstrument)
info.hints |= CB::PLUGIN_IS_SYNTH;
if (true)
info.hints |= CB::PLUGIN_HAS_CUSTOM_UI;

info.audioIns = static_cast<uint32_t>(desc->numInputChannels);
info.audioOuts = static_cast<uint32_t>(desc->numOutputChannels);
info.cvIns = 0;
info.cvOuts = 0;
info.midiIns = desc->isInstrument ? 1 : 0;
info.midiOuts = 0;
info.parameterIns = 0;
info.parameterOuts = 0;

sname = desc->name.toRawUTF8();
slabel = desc->fileOrIdentifier.toRawUTF8();
smaker = desc->manufacturerName.toRawUTF8();

info.name = sname;
info.label = slabel;
info.maker = smaker;
info.copyright = gCachedPluginsNullCharPtr;

return &info;
}
#endif

// -------------------------------------------------------------------------------------------------------------------

#ifdef HAVE_SFZ
static const CarlaCachedPluginInfo* get_cached_plugin_sfz(const water::File& file)
{
@@ -796,12 +716,6 @@ uint carla_get_cached_plugin_count(CB::PluginType ptype, const char* pluginPath)
return lv2World.getPluginCount();
}

#if defined(USING_JUCE) && defined(CARLA_OS_MAC)
case CB::PLUGIN_AU:
findAUs();
return static_cast<uint>(gCachedAuPluginResults.size());
#endif

#ifdef HAVE_SFZ
case CB::PLUGIN_SFZ:
findSFZs(pluginPath);
@@ -847,12 +761,6 @@ const CarlaCachedPluginInfo* carla_get_cached_plugin_info(CB::PluginType ptype,
return get_cached_plugin_lv2(lv2World, lilvPlugin);
}

#if defined(USING_JUCE) && defined(CARLA_OS_MAC)
case CB::PLUGIN_AU:
CARLA_SAFE_ASSERT_BREAK(index < static_cast<uint>(gCachedAuPluginResults.size()));
return get_cached_plugin_au(gCachedAuPluginResults.strings.getUnchecked(static_cast<int>(index)));
#endif

#ifdef HAVE_SFZ
case CB::PLUGIN_SFZ:
CARLA_SAFE_ASSERT_BREAK(index < gSFZs.size());


+ 6
- 32
source/backend/utils/Information.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
*
* 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.
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaUtils.h"
#include "CarlaString.hpp"
@@ -31,10 +17,6 @@
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
#endif

#if defined(USING_JUCE) && !defined(BUILD_BRIDGE)
# include "carla_juce/carla_juce.h"
#endif

#ifdef USING_RTAUDIO
# include "rtaudio/RtAudio.h"
# include "rtmidi/RtMidi.h"
@@ -126,19 +108,11 @@ const char* carla_get_juce_version()
{
carla_debug("carla_get_juce_version()");

static CarlaString retVersion;

#if defined(USING_JUCE) && !defined(BUILD_BRIDGE)
if (retVersion.isEmpty())
{
if (const char* const version = CarlaJUCE::getVersion())
retVersion = version+6;
else
retVersion = "Unknown";
}
#ifdef USING_JUCE
return "JUCE v7.0.1";
#else
return "Unknown";
#endif

return retVersion;
}

const char* const* carla_get_supported_file_extensions()


+ 8
- 22
source/backend/utils/JUCE.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2022 Filipe Coelho <falktx@falktx.com>
*
* 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.
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaUtils.h"

@@ -25,23 +11,23 @@

void carla_juce_init()
{
#ifdef USING_JUCE
#ifdef USING_JUCE
CarlaJUCE::initialiseJuce_GUI();
#endif
#endif
}

void carla_juce_idle()
{
#ifdef USING_JUCE
#ifdef USING_JUCE
CarlaJUCE::idleJuce_GUI();
#endif
#endif
}

void carla_juce_cleanup()
{
#ifdef USING_JUCE
#ifdef USING_JUCE
CarlaJUCE::shutdownJuce_GUI();
#endif
#endif
}

// -------------------------------------------------------------------------------------------------------------------

+ 4
- 26
source/backend/utils/Makefile View File

@@ -13,6 +13,9 @@ BUILD_CXX_FLAGS += $(FLUIDSYNTH_FLAGS)
BUILD_CXX_FLAGS += $(MAGIC_LIBS)
BUILD_CXX_FLAGS += $(YSFX_FLAGS)

# FIXME remove this after getting rid of juce
BUILD_CXX_FLAGS += -UUSING_JUCE

# ---------------------------------------------------------------------------------------------------------------------

OBJS = \
@@ -37,18 +40,6 @@ ifeq ($(HAVE_YSFX),true)
LIBS += $(MODULEDIR)/ysfx.a
endif

ifeq ($(USING_JUCE),true)
LIBS += $(MODULEDIR)/carla_juce.a
LIBS += $(MODULEDIR)/juce_audio_basics.a
LIBS += $(MODULEDIR)/juce_audio_processors.a
LIBS += $(MODULEDIR)/juce_core.a
LIBS += $(MODULEDIR)/juce_data_structures.a
LIBS += $(MODULEDIR)/juce_events.a
LIBS += $(MODULEDIR)/juce_graphics.a
LIBS += $(MODULEDIR)/juce_gui_basics.a
LIBS += $(MODULEDIR)/juce_gui_extra.a
endif

LINK_FLAGS += $(JACKBRIDGE_LIBS)
LINK_FLAGS += $(LILV_LIBS)
LINK_FLAGS += $(WATER_LIBS)
@@ -67,17 +58,6 @@ LINK_FLAGS += -pthread
endif
endif

ifeq ($(USING_JUCE),true)
LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS)
LINK_FLAGS += $(JUCE_AUDIO_PROCESSORS_LIBS)
LINK_FLAGS += $(JUCE_CORE_LIBS)
LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS)
LINK_FLAGS += $(JUCE_EVENTS_LIBS)
LINK_FLAGS += $(JUCE_GRAPHICS_LIBS)
LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS)
LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS)
endif

# ---------------------------------------------------------------------------------------------------------------------

all: $(TARGETS)
@@ -100,12 +80,10 @@ $(BINDIR)/libcarla_utils$(LIB_EXT): $(OBJS) $(LIBS)
# ---------------------------------------------------------------------------------------------------------------------

ifeq ($(MACOS),true)
ifeq ($(USING_JUCE),true)
$(OBJDIR)/CachedPlugins.cpp.o: BUILD_CXX_FLAGS += -std=gnu++14
endif
$(OBJDIR)/CarlaUtils.cpp.o: BUILD_CXX_FLAGS += -ObjC++

$(OBJDIR)/Windows.cpp.o: BUILD_CXX_FLAGS += -ObjC++

endif

$(OBJDIR)/%.cpp.o: %.cpp


+ 7
- 17
source/backend/utils/PluginDiscovery.cpp View File

@@ -1,19 +1,5 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
*
* 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.
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "CarlaUtils.h"

@@ -760,7 +746,6 @@ CarlaPluginDiscoveryHandle carla_plugin_discovery_start(const char* const discov
}

case CB::PLUGIN_INTERNAL:
case CB::PLUGIN_AU:
return new CarlaPluginDiscovery(discoveryTool, btype, ptype, discoveryCb, checkCacheCb, callbackPtr);

case CB::PLUGIN_LADSPA:
@@ -808,6 +793,11 @@ CarlaPluginDiscoveryHandle carla_plugin_discovery_start(const char* const discov
wildcard = "*.vst3";
break;

case CB::PLUGIN_AU:
directories = true;
wildcard = "*.component";
break;

case CB::PLUGIN_CLAP:
wildcard = "*.clap";
#ifdef CARLA_OS_MAC


+ 0
- 32
source/discovery/Makefile View File

@@ -8,13 +8,6 @@ CWD=..
MODULENAME=carla-discovery
include $(CWD)/Makefile.mk

# Workaround GCC bug
ifeq ($(TESTBUILD),true)
ifeq ($(USING_JUCE),true)
BUILD_CXX_FLAGS += -Wno-undef
endif
endif

# ---------------------------------------------------------------------------------------------------------------------

BINDIR := $(CWD)/../bin
@@ -46,10 +39,6 @@ BUILD_CXX_FLAGS += -pthread
LINK_FLAGS += -pthread
endif

ifeq ($(USING_JUCE),true)
BUILD_CXX_FLAGS += -std=gnu++14
endif

32BIT_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_ALTERNATIVE_ARCH
64BIT_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_ALTERNATIVE_ARCH
ARM32_FLAGS += -DBUILD_BRIDGE -DBUILD_BRIDGE_ALTERNATIVE_ARCH
@@ -97,27 +86,6 @@ LIBS_win32 += $(MODULEDIR)/jackbridge.win32e.a
LIBS_win64 += $(MODULEDIR)/jackbridge.win64e.a
endif

ifeq ($(USING_JUCE),true)
LIBS_native += $(MODULEDIR)/carla_juce.a
LIBS_native += $(MODULEDIR)/juce_audio_basics.a
LIBS_native += $(MODULEDIR)/juce_audio_processors.a
LIBS_native += $(MODULEDIR)/juce_core.a
LIBS_native += $(MODULEDIR)/juce_data_structures.a
LIBS_native += $(MODULEDIR)/juce_events.a
LIBS_native += $(MODULEDIR)/juce_graphics.a
LIBS_native += $(MODULEDIR)/juce_gui_basics.a
LIBS_native += $(MODULEDIR)/juce_gui_extra.a

LINK_FLAGS += $(JUCE_AUDIO_BASICS_LIBS)
LINK_FLAGS += $(JUCE_AUDIO_PROCESSORS_LIBS)
LINK_FLAGS += $(JUCE_CORE_LIBS)
LINK_FLAGS += $(JUCE_DATA_STRUCTURES_LIBS)
LINK_FLAGS += $(JUCE_EVENTS_LIBS)
LINK_FLAGS += $(JUCE_GRAPHICS_LIBS)
LINK_FLAGS += $(JUCE_GUI_BASICS_LIBS)
LINK_FLAGS += $(JUCE_GUI_EXTRA_LIBS)
endif # USING_JUCE

# ---------------------------------------------------------------------------------------------------------------------

OBJS_native = $(OBJDIR)/$(MODULENAME).cpp.o


+ 4
- 209
source/discovery/carla-discovery.cpp View File

@@ -36,7 +36,6 @@
#ifdef BUILD_BRIDGE
# undef HAVE_FLUIDSYNTH
# undef HAVE_YSFX
# undef USING_JUCE
#endif

#ifdef HAVE_FLUIDSYNTH
@@ -54,22 +53,6 @@
# include "../backend/utils/CachedPlugins.cpp"
#endif

#ifdef USING_JUCE
# include "carla_juce/carla_juce.h"
# pragma GCC diagnostic ignored "-Wdouble-promotion"
# pragma GCC diagnostic ignored "-Wduplicated-branches"
# pragma GCC diagnostic ignored "-Weffc++"
# pragma GCC diagnostic ignored "-Wfloat-equal"
# include "juce_audio_processors/juce_audio_processors.h"
# if JUCE_PLUGINHOST_VST
# define USING_JUCE_FOR_VST2
# endif
# if JUCE_PLUGINHOST_VST3
# define USING_JUCE_FOR_VST3
# endif
# pragma GCC diagnostic pop
#endif

// must be last
#ifdef BUILDING_CARLA_FOR_WINE
# include "../jackbridge/JackBridge.hpp"
@@ -230,11 +213,6 @@ static void do_cached_check(const PluginType type)
}
}

#ifdef USING_JUCE
if (type == PLUGIN_AU)
CarlaJUCE::initialiseJuce_GUI();
#endif

const uint count = carla_get_cached_plugin_count(type, plugPath);

for (uint i=0; i<count; ++i)
@@ -244,11 +222,6 @@ static void do_cached_check(const PluginType type)

print_cached_plugin(pinfo);
}

#ifdef USING_JUCE
if (type == PLUGIN_AU)
CarlaJUCE::shutdownJuce_GUI();
#endif
}
#endif // ! BUILD_BRIDGE

@@ -889,7 +862,6 @@ static void do_lv2_check(const char* const bundle, const bool doInit)
}
#endif // ! BUILD_BRIDGE

#ifndef USING_JUCE_FOR_VST2
// --------------------------------------------------------------------------------------------------------------------
// VST2

@@ -1452,12 +1424,10 @@ static bool do_vst2_check(lib_t& libHandle, const char* const filename, const bo
(void)filename;
#endif
}
#endif // ! USING_JUCE_FOR_VST2

// --------------------------------------------------------------------------------------------------------------------
// VST3

#ifndef USING_JUCE_FOR_VST3
struct carla_v3_host_application : v3_host_application_cpp {
carla_v3_host_application()
{
@@ -2033,7 +2003,6 @@ static bool do_vst3_check(lib_t& libHandle, const char* const filename, const bo
v3_exit();
return false;
}
#endif // ! USING_JUCE_FOR_VST3

// --------------------------------------------------------------------------------------------------------------------
// AU
@@ -2259,7 +2228,9 @@ static bool do_au_check(const char* const filename, const bool doInit)
{
hints |= PLUGIN_HAS_CUSTOM_UI;
#ifndef BUILD_BRIDGE
/* FIXME only enable this after doing custom AU hosting
hints |= PLUGIN_HAS_CUSTOM_EMBED_UI;
*/
#endif
}

@@ -2326,7 +2297,7 @@ static bool do_au_check(const char* const filename, const bool doInit)

return false;
}
#endif
#endif // CARLA_OS_MAC

// --------------------------------------------------------------------------------------------------------------------
// CLAP
@@ -2596,172 +2567,6 @@ static bool do_clap_check(lib_t& libHandle, const char* const filename, const bo
return false;
}

#ifdef USING_JUCE
// --------------------------------------------------------------------------------------------------------------------
// JUCE

// find all available plugin audio ports
static void findMaxTotalChannels(juce::AudioProcessor* const filter, int& maxTotalIns, int& maxTotalOuts)
{
filter->enableAllBuses();

const int numInputBuses = filter->getBusCount(true);
const int numOutputBuses = filter->getBusCount(false);

if (numInputBuses > 1 || numOutputBuses > 1)
{
maxTotalIns = maxTotalOuts = 0;

for (int i = 0; i < numInputBuses; ++i)
maxTotalIns += filter->getChannelCountOfBus(true, i);

for (int i = 0; i < numOutputBuses; ++i)
maxTotalOuts += filter->getChannelCountOfBus(false, i);
}
else
{
maxTotalIns = numInputBuses > 0 ? filter->getBus(true, 0)->getMaxSupportedChannels(64) : 0;
maxTotalOuts = numOutputBuses > 0 ? filter->getBus(false, 0)->getMaxSupportedChannels(64) : 0;
}
}

static bool do_juce_check(const char* const filename_, const char* const stype, const bool doInit)
{
CARLA_SAFE_ASSERT_RETURN(stype != nullptr && stype[0] != 0, false) // FIXME
carla_debug("do_juce_check(%s, %s, %s)", filename_, stype, bool2str(doInit));

CarlaJUCE::initialiseJuce_GUI();

juce::String filename;

#ifdef CARLA_OS_WIN
// Fix for wine usage
if (juce::File("Z:\\usr\\").isDirectory() && filename_[0] == '/')
{
filename = filename_;
filename.replace("/", "\\");
filename = "Z:" + filename;
}
else
#endif
{
filename = juce::File(filename_).getFullPathName();
}

CarlaScopedPointer<juce::AudioPluginFormat> pluginFormat;

/* */ if (std::strcmp(stype, "VST2") == 0)
{
#if JUCE_PLUGINHOST_VST
pluginFormat = new juce::VSTPluginFormat();
#else
DISCOVERY_OUT("error", "VST2 support not available");
return false;
#endif
}
else if (std::strcmp(stype, "VST3") == 0)
{
#if JUCE_PLUGINHOST_VST3
pluginFormat = new juce::VST3PluginFormat();
#else
DISCOVERY_OUT("error", "VST3 support not available");
return false;
#endif
}
else if (std::strcmp(stype, "AU") == 0)
{
#if JUCE_PLUGINHOST_AU
pluginFormat = new juce::AudioUnitPluginFormat();
#else
DISCOVERY_OUT("error", "AU support not available");
return false;
#endif
}

if (pluginFormat == nullptr)
{
DISCOVERY_OUT("error", stype << " support not available");
return false;
}

#ifdef CARLA_OS_WIN
CARLA_CUSTOM_SAFE_ASSERT_RETURN("Plugin file/folder does not exist", juce::File(filename).exists(), false);
#endif
CARLA_SAFE_ASSERT_RETURN(pluginFormat->fileMightContainThisPluginType(filename), false);

juce::OwnedArray<juce::PluginDescription> results;
pluginFormat->findAllTypesForFile(results, filename);

if (results.size() == 0)
{
#if defined(CARLA_OS_MAC) && defined(__aarch64__)
if (std::strcmp(stype, "VST2") == 0 || std::strcmp(stype, "VST3") == 0)
return true;
#endif
DISCOVERY_OUT("error", "No plugins found");
return false;
}

for (juce::PluginDescription **it = results.begin(), **end = results.end(); it != end; ++it)
{
juce::PluginDescription* const desc(*it);

uint hints = 0x0;
int audioIns = desc->numInputChannels;
int audioOuts = desc->numOutputChannels;
int midiIns = 0;
int midiOuts = 0;
int parameters = 0;

if (desc->isInstrument)
{
hints |= PLUGIN_IS_SYNTH;
midiIns = 1;
}

if (doInit)
{
if (std::unique_ptr<juce::AudioPluginInstance> instance
= pluginFormat->createInstanceFromDescription(*desc, kSampleRate, kBufferSize))
{
CarlaJUCE::idleJuce_GUI();

findMaxTotalChannels(instance.get(), audioIns, audioOuts);
instance->refreshParameterList();

parameters = instance->getParameters().size();

if (instance->hasEditor())
hints |= PLUGIN_HAS_CUSTOM_UI;
if (instance->acceptsMidi())
midiIns = 1;
if (instance->producesMidi())
midiOuts = 1;
}
}

DISCOVERY_OUT("init", "------------");
DISCOVERY_OUT("build", BINARY_NATIVE);
DISCOVERY_OUT("hints", hints);
DISCOVERY_OUT("category", getPluginCategoryAsString(getPluginCategoryFromName(desc->category.toRawUTF8())));
DISCOVERY_OUT("name", desc->descriptiveName);
DISCOVERY_OUT("label", desc->name);
DISCOVERY_OUT("maker", desc->manufacturerName);
DISCOVERY_OUT("uniqueId", desc->uniqueId);
DISCOVERY_OUT("audio.ins", audioIns);
DISCOVERY_OUT("audio.outs", audioOuts);
DISCOVERY_OUT("midi.ins", midiIns);
DISCOVERY_OUT("midi.outs", midiOuts);
DISCOVERY_OUT("parameters.ins", parameters);
DISCOVERY_OUT("end", "------------");
}

CarlaJUCE::idleJuce_GUI();
CarlaJUCE::shutdownJuce_GUI();
return false;
}
#endif // USING_JUCE_FOR_VST2

// --------------------------------------------------------------------------------------------------------------------
// fluidsynth (dls, sf2, sfz)

@@ -3102,25 +2907,15 @@ int main(int argc, const char* argv[])
#endif

case PLUGIN_VST2:
#if defined(USING_JUCE) && JUCE_PLUGINHOST_VST
retryAsX64lugin = do_juce_check(filename, "VST2", doInit);
#else
retryAsX64lugin = do_vst2_check(handle, filename, doInit);
#endif
break;

case PLUGIN_VST3:
#if defined(USING_JUCE) && JUCE_PLUGINHOST_VST3
retryAsX64lugin = do_juce_check(filename, "VST3", doInit);
#else
retryAsX64lugin = do_vst3_check(handle, filename, doInit);
#endif
break;

case PLUGIN_AU:
#if defined(USING_JUCE) && JUCE_PLUGINHOST_AU
do_juce_check(filename, "AU", doInit);
#elif defined(CARLA_OS_MAC)
#ifdef CARLA_OS_MAC
retryAsX64lugin = do_au_check(filename, doInit);
#else
DISCOVERY_OUT("error", "AU support not available");


+ 6
- 16
source/frontend/CarlaFrontend.h View File

@@ -1,19 +1,5 @@
/*
* Carla Plugin Host
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
*
* 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.
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

@@ -61,7 +47,11 @@ typedef struct {
uint parameterOuts;
} PluginListDialogResults;

#ifdef __cplusplus
class PluginListDialog;
#else
struct PluginListDialog;
#endif

// --------------------------------------------------------------------------------------------------------------------



+ 0
- 25
source/frontend/carla_utils.py View File

@@ -262,9 +262,6 @@ class CarlaUtils():
self.lib.carla_get_complete_license_text.argtypes = None
self.lib.carla_get_complete_license_text.restype = c_char_p

self.lib.carla_get_juce_version.argtypes = None
self.lib.carla_get_juce_version.restype = c_char_p

self.lib.carla_get_supported_file_extensions.argtypes = None
self.lib.carla_get_supported_file_extensions.restype = POINTER(c_char_p)

@@ -328,15 +325,6 @@ class CarlaUtils():
self.lib.carla_pipe_client_destroy.argtypes = [CarlaPipeClientHandle]
self.lib.carla_pipe_client_destroy.restype = None

self.lib.carla_juce_init.argtypes = None
self.lib.carla_juce_init.restype = None

self.lib.carla_juce_idle.argtypes = None
self.lib.carla_juce_idle.restype = None

self.lib.carla_juce_cleanup.argtypes = None
self.lib.carla_juce_cleanup.restype = None

self.lib.carla_get_desktop_scale_factor.argtypes = None
self.lib.carla_get_desktop_scale_factor.restype = c_double

@@ -399,10 +387,6 @@ class CarlaUtils():
def get_complete_license_text(self):
return charPtrToString(self.lib.carla_get_complete_license_text())

# Get the juce version used in the current Carla build.
def get_juce_version(self):
return charPtrToString(self.lib.carla_get_juce_version())

# Get the list of supported file extensions in carla_load_file().
def get_supported_file_extensions(self):
return charPtrPtrToStringList(self.lib.carla_get_supported_file_extensions())
@@ -484,15 +468,6 @@ class CarlaUtils():
def pipe_client_destroy(self, handle):
self.lib.carla_pipe_client_destroy(handle)

def juce_init(self):
self.lib.carla_juce_init()

def juce_idle(self):
self.lib.carla_juce_idle()

def juce_cleanup(self):
self.lib.carla_juce_cleanup()

def get_desktop_scale_factor(self):
return float(self.lib.carla_get_desktop_scale_factor())



+ 29
- 21
source/frontend/pluginlist/pluginlistdialog.cpp View File

@@ -1,8 +1,5 @@
/*
* Carla plugin host
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-2.0-or-later
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include "pluginlistdialog.hpp"
#include "pluginrefreshdialog.hpp"
@@ -65,6 +62,9 @@ struct PluginPaths {
QCarlaString vst2;
QCarlaString vst3;
QCarlaString clap;
#ifdef CARLA_OS_MAC
QCarlaString au;
#endif
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
QCarlaString jsfx;
QCarlaString sf2;
@@ -261,6 +261,12 @@ struct PluginPaths {
#endif
}

#ifdef CARLA_OS_MAC
au = HOME + "/Library/Audio/Plug-Ins/Components";
au += ":/Library/Audio/Plug-Ins/Components";
au += ":/System/Library/Components";
#endif

#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
if (const char *const envJSFX = std::getenv("JSFX_PATH"))
{
@@ -780,13 +786,13 @@ struct PluginListDialog::PrivateData {
std::vector<PluginInfo> vst2;
std::vector<PluginInfo> vst3;
std::vector<PluginInfo> clap;
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
#ifdef CARLA_OS_MAC
std::vector<PluginInfo> au;
#endif
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
std::vector<PluginInfo> jsfx;
std::vector<PluginInfo> kits;
#endif
#endif
QMap<QString, QList<PluginInfo>> cache;
QList<PluginFavorite> favorites;

@@ -803,14 +809,14 @@ struct PluginListDialog::PrivateData {
case PLUGIN_VST2: vst2.push_back(pinfo); return true;
case PLUGIN_VST3: vst3.push_back(pinfo); return true;
case PLUGIN_CLAP: clap.push_back(pinfo); return true;
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
#ifdef CARLA_OS_MAC
case PLUGIN_AU: au.push_back(pinfo); return true;
#endif
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
case PLUGIN_JSFX: jsfx.push_back(pinfo); return true;
case PLUGIN_SF2:
case PLUGIN_SFZ: kits.push_back(pinfo); return true;
#endif
#endif
default: return false;
}
}
@@ -1111,6 +1117,11 @@ void PluginListDialog::setPluginPath(const PluginType ptype, const char* const p
case PLUGIN_CLAP:
p->paths.clap = path;
break;
#ifdef CARLA_OS_MAC
case PLUGIN_AU:
p->paths.au = path;
break;
#endif
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
case PLUGIN_LADSPA:
p->paths.ladspa = path;
@@ -1245,17 +1256,14 @@ void PluginListDialog::timerEvent(QTimerEvent* const event)
p->discovery.ptype = PLUGIN_CLAP;
break;
case PLUGIN_CLAP:
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
#ifdef CARLA_OS_MAC
if (p->discovery.btype == BINARY_POSIX32 || p->discovery.btype == BINARY_POSIX64)
{
ui.label->setText(tr("Discovering AU plugins..."));
p->discovery.ptype = PLUGIN_AU;
break;
}
[[fallthrough]];
ui.label->setText(tr("Discovering AU plugins..."));
path = p->paths.au;
p->discovery.ptype = PLUGIN_AU;
break;
case PLUGIN_AU:
#endif
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
if (p->discovery.btype == BINARY_NATIVE && p->paths.jsfx.isNotEmpty())
{
ui.label->setText(tr("Discovering JSFX plugins..."));
@@ -1422,18 +1430,18 @@ void PluginListDialog::addPluginsToTable()
for (const PluginInfo& plugin : p->plugins.clap)
addPluginToTable(plugin);

#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
#ifdef CARLA_OS_MAC
for (const PluginInfo& plugin : p->plugins.au)
addPluginToTable(plugin);
#endif

#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
for (const PluginInfo& plugin : p->plugins.jsfx)
addPluginToTable(plugin);

for (const PluginInfo& plugin : p->plugins.kits)
addPluginToTable(plugin);
#endif
#endif

CARLA_SAFE_ASSERT_INT2(p->lastTableWidgetIndex == ui.tableWidget->rowCount(),
p->lastTableWidgetIndex, ui.tableWidget->rowCount());
@@ -1936,13 +1944,13 @@ void PluginListDialog::refreshPluginsStart()
p->plugins.vst2.clear();
p->plugins.vst3.clear();
p->plugins.clap.clear();
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
#ifdef CARLA_OS_MAC
p->plugins.au.clear();
#endif
#ifndef CARLA_FRONTEND_ONLY_EMBEDDABLE_PLUGINS
p->plugins.jsfx.clear();
p->plugins.kits.clear();
#endif
#endif
p->discovery.dialog->b_start->setEnabled(false);
p->discovery.dialog->b_skip->setEnabled(true);
p->discovery.ignoreCache = p->discovery.dialog->ch_all->isChecked();


+ 3
- 7
source/frontend/pluginlist/pluginlistdialog.hpp View File

@@ -1,8 +1,5 @@
/*
* Carla plugin host
* Copyright (C) 2011-2023 Filipe Coelho <falktx@falktx.com>
* SPDX-License-Identifier: GPL-2.0-or-later
*/
// SPDX-FileCopyrightText: 2011-2024 Filipe Coelho <falktx@falktx.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#pragma once

@@ -19,6 +16,7 @@
#endif

#include <QtWidgets/QDialog>
#include "ui_pluginlistdialog.h"

#ifdef __clang__
# pragma clang diagnostic pop
@@ -26,8 +24,6 @@
# pragma GCC diagnostic pop
#endif

#include "ui_pluginlistdialog.h"

class QSafeSettings;
typedef struct _CarlaPluginDiscoveryInfo CarlaPluginDiscoveryInfo;
typedef struct _HostSettings HostSettings;


Loading…
Cancel
Save