Browse Source

Implement LV2_STATE__freePath

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
85fa525178
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 38 additions and 0 deletions
  1. +19
    -0
      source/backend/plugin/CarlaPluginLV2.cpp
  2. +17
    -0
      source/bridges-ui/CarlaBridgeFormatLV2.cpp
  3. +2
    -0
      source/utils/CarlaLv2Utils.hpp

+ 19
- 0
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -161,6 +161,7 @@ enum CarlaLv2Features {
kFeatureIdResizePort,
kFeatureIdRtMemPool,
kFeatureIdRtMemPoolOld,
kFeatureIdStateFreePath,
kFeatureIdStateMakePath,
kFeatureIdStateMapPath,
kFeatureIdStrictBounds,
@@ -718,6 +719,9 @@ public:
if (fFeatures[kFeatureIdLogs] != nullptr && fFeatures[kFeatureIdLogs]->data != nullptr)
delete (LV2_Log_Log*)fFeatures[kFeatureIdLogs]->data;

if (fFeatures[kFeatureIdStateFreePath] != nullptr && fFeatures[kFeatureIdStateFreePath]->data != nullptr)
delete (LV2_State_Free_Path*)fFeatures[kFeatureIdStateFreePath]->data;

if (fFeatures[kFeatureIdStateMakePath] != nullptr && fFeatures[kFeatureIdStateMakePath]->data != nullptr)
delete (LV2_State_Make_Path*)fFeatures[kFeatureIdStateMakePath]->data;

@@ -5902,6 +5906,10 @@ public:
logFt->printf = carla_lv2_log_printf;
logFt->vprintf = carla_lv2_log_vprintf;

LV2_State_Free_Path* const stateFreePathFt = new LV2_State_Free_Path;
stateFreePathFt->handle = this;
stateFreePathFt->free_path = carla_lv2_state_free_path;

LV2_State_Make_Path* const stateMakePathFt = new LV2_State_Make_Path;
stateMakePathFt->handle = this;
stateMakePathFt->path = carla_lv2_state_make_path;
@@ -5996,6 +6004,9 @@ public:
fFeatures[kFeatureIdRtMemPoolOld]->URI = LV2_RTSAFE_MEMORY_POOL_DEPRECATED_URI;
fFeatures[kFeatureIdRtMemPoolOld]->data = rtMemPoolOldFt;

fFeatures[kFeatureIdStateFreePath]->URI = LV2_STATE__freePath;
fFeatures[kFeatureIdStateFreePath]->data = stateFreePathFt;

fFeatures[kFeatureIdStateMakePath]->URI = LV2_STATE__makePath;
fFeatures[kFeatureIdStateMakePath]->data = stateMakePathFt;

@@ -6836,6 +6847,14 @@ private:
// -------------------------------------------------------------------
// State Feature

static void carla_lv2_state_free_path(LV2_State_Free_Path_Handle handle, char* path)
{
CARLA_SAFE_ASSERT_RETURN(handle != nullptr,);
carla_debug("carla_lv2_state_free_path(%p, \"%s\")", handle, path);

std::free(path);
}

static char* carla_lv2_state_make_path(LV2_State_Make_Path_Handle handle, const char* path)
{
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, nullptr);


+ 17
- 0
source/bridges-ui/CarlaBridgeFormatLV2.cpp View File

@@ -113,6 +113,7 @@ enum CarlaLv2Features {
kFeatureIdLogs = 0,
kFeatureIdOptions,
kFeatureIdPrograms,
kFeatureIdStateFreePath,
kFeatureIdStateMakePath,
kFeatureIdStateMapPath,
kFeatureIdUriMap,
@@ -248,6 +249,10 @@ public:
logFt->printf = carla_lv2_log_printf;
logFt->vprintf = carla_lv2_log_vprintf;

LV2_State_Free_Path* const stateFreePathFt = new LV2_State_Free_Path;
stateFreePathFt->handle = this;
stateFreePathFt->free_path = carla_lv2_state_free_path;

LV2_State_Make_Path* const stateMakePathFt = new LV2_State_Make_Path;
stateMakePathFt->handle = this;
stateMakePathFt->path = carla_lv2_state_make_path;
@@ -300,6 +305,9 @@ public:
fFeatures[kFeatureIdPrograms]->URI = LV2_PROGRAMS__Host;
fFeatures[kFeatureIdPrograms]->data = programsFt;

fFeatures[kFeatureIdStateFreePath]->URI = LV2_STATE__freePath;
fFeatures[kFeatureIdStateFreePath]->data = stateFreePathFt;

fFeatures[kFeatureIdStateMakePath]->URI = LV2_STATE__makePath;
fFeatures[kFeatureIdStateMakePath]->data = stateMakePathFt;

@@ -366,6 +374,7 @@ public:
fRdfUiDescriptor = nullptr;

delete (LV2_Log_Log*)fFeatures[kFeatureIdLogs]->data;
delete (LV2_State_Free_Path*)fFeatures[kFeatureIdStateFreePath]->data;
delete (LV2_State_Make_Path*)fFeatures[kFeatureIdStateMakePath]->data;
delete (LV2_State_Map_Path*)fFeatures[kFeatureIdStateMapPath]->data;
delete (LV2_Programs_Host*)fFeatures[kFeatureIdPrograms]->data;
@@ -971,6 +980,14 @@ private:
// ----------------------------------------------------------------------------------------------------------------
// State Feature

static void carla_lv2_state_free_path(LV2_State_Free_Path_Handle handle, char* path)
{
CARLA_SAFE_ASSERT_RETURN(handle != nullptr,);
carla_debug("carla_lv2_state_free_path(%p, \"%s\")", handle, path);

std::free(path);
}

static char* carla_lv2_state_make_path(LV2_State_Make_Path_Handle handle, const char* path)
{
CARLA_SAFE_ASSERT_RETURN(handle != nullptr, nullptr);


+ 2
- 0
source/utils/CarlaLv2Utils.hpp View File

@@ -3072,6 +3072,8 @@ bool is_lv2_feature_supported(const LV2_URI uri) noexcept
return true;
if (std::strcmp(uri, LV2_RTSAFE_MEMORY_POOL_DEPRECATED_URI) == 0)
return true;
if (std::strcmp(uri, LV2_STATE__freePath) == 0)
return true;
if (std::strcmp(uri, LV2_STATE__loadDefaultState) == 0)
return true;
if (std::strcmp(uri, LV2_STATE__makePath) == 0)


Loading…
Cancel
Save