Browse Source

Allow loading arbitrary files/binaries as plugins

Signed-off-by: falkTX <falktx@falktx.com>
tags/v1.2
falkTX 2 years ago
parent
commit
7feb4b893b
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 61 additions and 9 deletions
  1. +1
    -1
      carla
  2. +1
    -1
      dpf
  3. +59
    -7
      plugins/Common/IldaeilUI.cpp

+ 1
- 1
carla

@@ -1 +1 @@
Subproject commit 699515158062a95d2bbee246e5a19e06d4e3c2bd
Subproject commit df1338860e0b6fae36b974618ecfeb005051158b

+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 1bdbb7d9e13fc6e1f25506c127efa3cd48ec91ef
Subproject commit 55a1e21ebbb42a4778f26188a9f75aecb0c1210c

+ 59
- 7
plugins/Common/IldaeilUI.cpp View File

@@ -167,7 +167,7 @@ class IldaeilUI : public UI,
bool fPluginSearchFirstShow;
char fPluginSearchString[0xff];

String fPopupError;
String fPopupError, fPluginFilename;
Size<uint> fNextSize;

struct RunnerData {
@@ -533,6 +533,7 @@ public:
{
fPluginRunning = true;
fPluginGenericUI = nullptr;
fPluginFilename.clear();
showPluginUI(handle, false);

#ifdef WASM_TESTING
@@ -557,6 +558,36 @@ public:
repaint();
}

void loadFileAsPlugin(const CarlaHostHandle handle, const char* const filename)
{
if (fPluginRunning || fPluginId != 0)
{
hidePluginUI(handle);
carla_replace_plugin(handle, fPluginId);
}

carla_set_engine_option(handle, ENGINE_OPTION_PREFER_PLUGIN_BRIDGES, fPluginWillRunInBridgeMode, nullptr);

const MutexLocker cml(fPlugin->sPluginInfoLoadMutex);

if (carla_load_file(handle, filename))
{
fPluginRunning = true;
fPluginGenericUI = nullptr;
fPluginFilename = filename;
showPluginUI(handle, false);
}
else
{
fPopupError = carla_get_last_error(handle);
d_stdout("got error: %s", fPopupError.buffer());
fDrawingState = kDrawingPluginError;
fPluginFilename.clear();
}

repaint();
}

protected:
void pluginWindowResized(const uint width, const uint height) override
{
@@ -609,7 +640,10 @@ protected:

case kIdleResetPlugin:
fIdleState = kIdleNothing;
loadPlugin(handle, carla_get_plugin_info(handle, fPluginId)->label);
if (fPluginFilename.isNotEmpty())
loadFileAsPlugin(handle, fPluginFilename.buffer());
else
loadPlugin(handle, carla_get_plugin_info(handle, fPluginId)->label);
break;

case kIdleOpenFileUI:
@@ -643,10 +677,19 @@ protected:
fIdleState = kIdleNothing;
if (fPluginRunning)
hidePluginUI(handle);
fPluginSelected = -1;
stopRunner();
fPluginType = fNextPluginType;
initAndStartRunner();
if (fNextPluginType == PLUGIN_TYPE_COUNT)
{
FileBrowserOptions opts;
opts.title = "Load from file";
openFileBrowser(opts);
}
else
{
fPluginSelected = -1;
stopRunner();
fPluginType = fNextPluginType;
initAndStartRunner();
}
break;

case kIdleNothing:
@@ -689,7 +732,12 @@ protected:
void uiFileBrowserSelected(const char* const filename) override
{
if (fPlugin != nullptr && fPlugin->fCarlaHostHandle != nullptr && filename != nullptr)
carla_set_custom_data(fPlugin->fCarlaHostHandle, fPluginId, CUSTOM_DATA_TYPE_STRING, "file", filename);
{
if (fNextPluginType == PLUGIN_TYPE_COUNT)
loadFileAsPlugin(fPlugin->fCarlaHostHandle, filename);
else
carla_set_custom_data(fPlugin->fCarlaHostHandle, fPluginId, CUSTOM_DATA_TYPE_STRING, "file", filename);
}
}

bool initAndStartRunner()
@@ -1087,6 +1135,7 @@ protected:
getPluginTypeAsString(PLUGIN_INTERNAL),
getPluginTypeAsString(PLUGIN_LV2),
getPluginTypeAsString(PLUGIN_JSFX),
"Load from file..."
};

setupMainWindowPos();
@@ -1157,6 +1206,9 @@ protected:
case 2:
fNextPluginType = PLUGIN_JSFX;
break;
case 3:
fNextPluginType = PLUGIN_TYPE_COUNT;
break;
}
}



Loading…
Cancel
Save