Browse Source

Add stub functions for plugin lv2-export in backend

tags/1.9.8
falkTX 7 years ago
parent
commit
efbec398aa
5 changed files with 60 additions and 0 deletions
  1. +7
    -0
      source/backend/CarlaHost.h
  2. +5
    -0
      source/backend/CarlaPlugin.hpp
  3. +19
    -0
      source/backend/CarlaStandalone.cpp
  4. +10
    -0
      source/backend/plugin/CarlaPlugin.cpp
  5. +19
    -0
      source/carla_backend.py

+ 7
- 0
source/backend/CarlaHost.h View File

@@ -534,6 +534,13 @@ CARLA_EXPORT bool carla_load_plugin_state(uint pluginId, const char* filename);
*/
CARLA_EXPORT bool carla_save_plugin_state(uint pluginId, const char* filename);

/*!
* Export plugin as LV2.
* @param pluginId Plugin
* @param lv2path Path to lv2 plugin folder
*/
CARLA_EXPORT bool carla_export_plugin_lv2(uint pluginId, const char* lv2path);

/*!
* Get information from a plugin.
* @param pluginId Plugin


+ 5
- 0
source/backend/CarlaPlugin.hpp View File

@@ -416,6 +416,11 @@ public:
*/
bool loadStateFromFile(const char* const filename);

/*!
* Export this plugin as LV2.
*/
bool exportAsLV2(const char* const lv2path);

// -------------------------------------------------------------------
// Set data (internal stuff)



+ 19
- 0
source/backend/CarlaStandalone.cpp View File

@@ -940,6 +940,25 @@ bool carla_save_plugin_state(uint pluginId, const char* filename)
return false;
}

bool carla_export_plugin_lv2(uint pluginId, const char* lv2path)
{
CARLA_SAFE_ASSERT_RETURN(lv2path != nullptr && lv2path[0] != '\0', false);
carla_debug("carla_export_plugin_lv2(%i, \"%s\")", pluginId, lv2path);

if (gStandalone.engine == nullptr)
{
carla_stderr2("Engine is not running");
gStandalone.lastError = "Engine is not running";
return false;
}

if (CarlaPlugin* const plugin = gStandalone.engine->getPlugin(pluginId))
return plugin->exportAsLV2(lv2path);

carla_stderr2("carla_export_plugin_lv2(%i, \"%s\") - could not find plugin", pluginId, lv2path);
return false;
}

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

const CarlaPluginInfo* carla_get_plugin_info(uint pluginId)


+ 10
- 0
source/backend/plugin/CarlaPlugin.cpp View File

@@ -917,6 +917,16 @@ bool CarlaPlugin::loadStateFromFile(const char* const filename)
return false;
}

bool CarlaPlugin::exportAsLV2(const char* const lv2path)
{
CARLA_SAFE_ASSERT_RETURN(lv2path != nullptr && lv2path[0] != '\0', false);
carla_debug("CarlaPlugin::exportAsLV2(\"%s\")", lv2path);

// TODO

return false;
}

// -------------------------------------------------------------------
// Set data (internal stuff)



+ 19
- 0
source/carla_backend.py View File

@@ -1474,6 +1474,12 @@ class CarlaHostMeta(object):
def save_plugin_state(self, pluginId, filename):
raise NotImplementedError

# Export plugin as LV2.
# @param pluginId Plugin
# @param lv2path Path to lv2 plugin folder
def export_plugin_lv2(self, pluginId, lv2path):
raise NotImplementedError

# Get information from a plugin.
# @param pluginId Plugin
@abstractmethod
@@ -1959,6 +1965,9 @@ class CarlaHostNull(CarlaHostMeta):
def save_plugin_state(self, pluginId, filename):
return False

def export_plugin_lv2(self, pluginId, lv2path):
return False

def get_plugin_info(self, pluginId):
return PyCarlaPluginInfo

@@ -2235,6 +2244,9 @@ class CarlaHostDLL(CarlaHostMeta):
self.lib.carla_save_plugin_state.argtypes = [c_uint, c_char_p]
self.lib.carla_save_plugin_state.restype = c_bool

self.lib.carla_export_plugin_lv2.argtypes = [c_uint, c_char_p]
self.lib.carla_export_plugin_lv2.restype = c_bool

self.lib.carla_get_plugin_info.argtypes = [c_uint]
self.lib.carla_get_plugin_info.restype = POINTER(CarlaPluginInfo)

@@ -2506,6 +2518,9 @@ class CarlaHostDLL(CarlaHostMeta):
def save_plugin_state(self, pluginId, filename):
return bool(self.lib.carla_save_plugin_state(pluginId, filename.encode("utf-8")))

def export_plugin_lv2(self, pluginId, lv2path):
return bool(self.lib.carla_export_plugin_lv2(pluginId, lv2path.encode("utf-8")))

def get_plugin_info(self, pluginId):
return structToDict(self.lib.carla_get_plugin_info(pluginId).contents)

@@ -2839,6 +2854,10 @@ class CarlaHostPlugin(CarlaHostMeta):
def save_plugin_state(self, pluginId, filename):
return self.sendMsgAndSetError(["save_plugin_state", pluginId, filename])

def export_plugin_lv2(self, pluginId, lv2path):
self.fLastError = "Operation unavailable in plugin version"
return False

def get_plugin_info(self, pluginId):
return self.fPluginsInfo[pluginId].pluginInfo



Loading…
Cancel
Save