Enable JSFX plugin support in Ildaeil

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-05-25 14:19:05 +01:00
parent 70d73741ee
commit 20e6f30bcc
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
5 changed files with 71 additions and 17 deletions

2
carla

@ -1 +1 @@
Subproject commit 54effcd901f4540aff9ff933880941d9153bd50a
Subproject commit 0972c333b4de0a53a5bfb9731d558965e0010f7d

View file

@ -52,6 +52,19 @@ json_t *jsonp_stringn_nocheck_own(const char* value, size_t len);
}
#endif
// defined elsewhere
namespace rack {
#ifdef ARCH_WIN
enum SpecialPath {
kSpecialPathUserProfile,
kSpecialPathCommonProgramFiles,
kSpecialPathAppData,
};
std::string getSpecialPath(const SpecialPath type)
#endif
std::string homeDir();
}
#define BUFFER_SIZE 128
// generates a warning if this is defined as anything else
@ -97,6 +110,28 @@ static void projectLoadedFromDSP(void* ui);
static Mutex sPluginInfoLoadMutex;
static const char* getPathForJSFX()
{
static std::string path;
if (path.empty())
{
#if defined(CARLA_OS_MAC)
path = homeDir() + "/Library/Application Support/REAPER/Effects";
#elif defined(CARLA_OS_WIN)
path = getSpecialPath() + "\\REAPER\\Effects"
#else
if (const char* const configHome = std::getenv("XDG_CONFIG_HOME"))
path = configHome;
else
path = homeDir() + "/.config";
path += "/REAPER/Effects";
#endif
}
return path.c_str();
}
/*
#ifndef HEADLESS
struct JuceInitializer {
@ -249,6 +284,8 @@ struct IldaeilModule : Module {
if (const char* const path = std::getenv("LV2_PATH"))
carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PLUGIN_PATH, PLUGIN_LV2, path);
carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PLUGIN_PATH, PLUGIN_JSFX, getPathForJSFX());
#ifdef CARLA_OS_MAC
carla_set_engine_option(fCarlaHostHandle, ENGINE_OPTION_PREFER_UI_BRIDGES, 0, nullptr);
#endif
@ -1068,7 +1105,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
{
case PLUGIN_INTERNAL:
case PLUGIN_AU:
// case PLUGIN_JSFX:
case PLUGIN_JSFX:
case PLUGIN_SFZ:
label = info.label;
break;
@ -1096,6 +1133,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
case PLUGIN_LV2:
path = std::getenv("LV2_PATH");
break;
case PLUGIN_JSFX:
path = getPathForJSFX();
break;
default:
path = nullptr;
break;
@ -1386,6 +1426,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
static const char* pluginTypes[] = {
getPluginTypeAsString(PLUGIN_INTERNAL),
getPluginTypeAsString(PLUGIN_LV2),
getPluginTypeAsString(PLUGIN_JSFX),
};
setupMainWindowPos();
@ -1431,6 +1472,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
int current;
switch (fPluginType)
{
case PLUGIN_JSFX:
current = 2;
break;
case PLUGIN_LV2:
current = 1;
break;
@ -1450,6 +1494,9 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
case 1:
fNextPluginType = PLUGIN_LV2;
break;
case 2:
fNextPluginType = PLUGIN_JSFX;
break;
}
}
@ -1485,7 +1532,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
case PLUGIN_INTERNAL:
case PLUGIN_AU:
case PLUGIN_SFZ:
// case PLUGIN_JSFX:
case PLUGIN_JSFX:
ImGui::TableSetupColumn("Name");
ImGui::TableSetupColumn("Label");
ImGui::TableHeadersRow();
@ -1512,7 +1559,7 @@ struct IldaeilWidget : ImGuiWidget, IdleCallback, Thread {
{
case PLUGIN_INTERNAL:
case PLUGIN_AU:
// case PLUGIN_JSFX:
case PLUGIN_JSFX:
case PLUGIN_SFZ:
ImGui::TableNextRow();
ImGui::TableSetColumnIndex(0);

View file

@ -55,6 +55,7 @@
const std::string CARDINAL_VERSION = "22.05";
namespace rack {
namespace settings {
int rateLimit = 0;
}
@ -76,6 +77,9 @@ std::string getSpecialPath(const SpecialPath type)
case kSpecialPathCommonProgramFiles:
csidl = CSIDL_PROGRAM_FILES_COMMON;
break;
case kSpecialPathAppData:
csidl = CSIDL_COMMON_APPDATA;
break;
default:
return {};
}
@ -88,8 +92,22 @@ std::string getSpecialPath(const SpecialPath type)
return {};
}
#endif
std::string homeDir()
{
# ifdef ARCH_WIN
return getSpecialPath(kSpecialPathUserProfile);
# else
if (const char* const home = getenv("HOME"))
return home;
if (struct passwd* const pwd = getpwuid(getuid()))
return pwd->pw_dir;
# endif
return {};
}
} // namespace rack
namespace patchUtils
{
@ -103,19 +121,6 @@ static void promptClear(const char* const message, const std::function<void()> a
asyncDialog::create(message, action);
}
static std::string homeDir()
{
# ifdef ARCH_WIN
return getSpecialPath(kSpecialPathUserProfile);
# else
if (const char* const home = getenv("HOME"))
return home;
if (struct passwd* const pwd = getpwuid(getuid()))
return pwd->pw_dir;
# endif
return {};
}
#endif
void loadDialog()

View file

@ -47,6 +47,7 @@ bool isStandalone();
enum SpecialPath {
kSpecialPathUserProfile,
kSpecialPathCommonProgramFiles,
kSpecialPathAppData,
};
std::string getSpecialPath(SpecialPath type);
#endif

View file

@ -43,6 +43,7 @@ CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/lilv.a
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/rtmempool.a
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/sfzero.a
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/water.a
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/ysfx.a
CARLA_EXTRA_LIBS += $(CARLA_BUILD_DIR)/modules/$(CARLA_BUILD_TYPE)/zita-resampler.a
endif # STATIC_BUILD