Browse Source

Rename and move 2 functions

tags/v1.9.9
falkTX 7 years ago
parent
commit
1b1a2b26c7
4 changed files with 86 additions and 74 deletions
  1. +13
    -12
      source/backend/CarlaPlugin.hpp
  2. +13
    -10
      source/backend/plugin/CarlaPlugin.cpp
  3. +8
    -5
      source/backend/plugin/CarlaPluginBridge.cpp
  4. +52
    -47
      source/backend/plugin/CarlaPluginLV2.cpp

+ 13
- 12
source/backend/CarlaPlugin.hpp View File

@@ -262,18 +262,6 @@ public:
*/
const CustomData& getCustomData(const uint32_t index) const noexcept;

/*!
* Give the plugin a change to update its custom data sets.
*
* @see getCustomDataCount() and getCustomData()
*/
virtual void updateCustomData() noexcept;

/*!
* Helper function for LV2 plugins, internal use only!
*/
virtual void restoreLV2State() noexcept;

/*!
* Get the complete plugin chunk data into @a dataPtr.
*
@@ -952,6 +940,19 @@ protected:
struct ProtectedData;
ProtectedData* const pData;

// -------------------------------------------------------------------
// Internal helper functions

/*!
* Call LV2 restore.
*/
virtual void restoreLV2State() noexcept;

/*!
* Give plugin bridges a change to update their custom data sets.
*/
virtual void waitForBridgeSaveSignal() noexcept;

// -------------------------------------------------------------------
// Helper classes



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

@@ -269,14 +269,6 @@ const CustomData& CarlaPlugin::getCustomData(const uint32_t index) const noexcep
return pData->custom.getAt(index, kCustomDataFallback);
}

void CarlaPlugin::updateCustomData() noexcept
{
}

void CarlaPlugin::restoreLV2State() noexcept
{
}

std::size_t CarlaPlugin::getChunkData(void** const dataPtr) noexcept
{
CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0);
@@ -502,7 +494,7 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave)

getLabel(strBuf);

pData->stateSave.type = carla_strdup(getPluginTypeAsString(getType()));
pData->stateSave.type = carla_strdup(getPluginTypeAsString(pluginType));
pData->stateSave.name = carla_strdup(pData->name);
pData->stateSave.label = carla_strdup(strBuf);
pData->stateSave.uniqueId = getUniqueId();
@@ -611,7 +603,8 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave)
// ---------------------------------------------------------------
// Custom Data

updateCustomData();
if (pData->hints & PLUGIN_IS_BRIDGE)
waitForBridgeSaveSignal();

for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next())
{
@@ -2468,6 +2461,16 @@ void CarlaPlugin::setPatchbayNodeId(const uint32_t nodeId) noexcept
pData->nodeId = nodeId;
}

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

void CarlaPlugin::restoreLV2State() noexcept
{
}

void CarlaPlugin::waitForBridgeSaveSignal() noexcept
{
}

// -------------------------------------------------------------------
// Scoped Disabler



+ 8
- 5
source/backend/plugin/CarlaPluginBridge.cpp View File

@@ -477,11 +477,6 @@ public:
// -------------------------------------------------------------------
// Information (current data)

void updateCustomData() noexcept override
{
waitForSaved();
}

std::size_t getChunkData(void** const dataPtr) noexcept override
{
CARLA_SAFE_ASSERT_RETURN(pData->options & PLUGIN_OPTION_USE_CHUNKS, 0);
@@ -1737,6 +1732,14 @@ public:
fShmNonRtClientControl.commitWrite();
}

// -------------------------------------------------------------------
// Internal helper functions

void waitForBridgeSaveSignal() noexcept override
{
waitForSaved();
}

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

void handleNonRtData()


+ 52
- 47
source/backend/plugin/CarlaPluginLV2.cpp View File

@@ -823,53 +823,7 @@ public:
// -------------------------------------------------------------------
// Information (current data)

void restoreLV2State() noexcept override
{
if (fExt.state == nullptr)
return;

LV2_State_Status status = LV2_STATE_ERR_UNKNOWN;

{
const ScopedSingleProcessLocker spl(this, true);

try {
status = fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures);
} catch(...) {}

if (fHandle2 != nullptr)
{
try {
fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures);
} catch(...) {}
}
}

switch (status)
{
case LV2_STATE_SUCCESS:
carla_debug("CarlaPluginLV2::updateLV2State() - success");
break;
case LV2_STATE_ERR_UNKNOWN:
carla_stderr("CarlaPluginLV2::updateLV2State() - unknown error");
break;
case LV2_STATE_ERR_BAD_TYPE:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad type");
break;
case LV2_STATE_ERR_BAD_FLAGS:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad flags");
break;
case LV2_STATE_ERR_NO_FEATURE:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing feature");
break;
case LV2_STATE_ERR_NO_PROPERTY:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing property");
break;
case LV2_STATE_ERR_NO_SPACE:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, insufficient space");
break;
}
}
// nothing

// -------------------------------------------------------------------
// Information (per-plugin data)
@@ -4158,6 +4112,57 @@ public:
#endif
}

// -------------------------------------------------------------------
// Internal helper functions

void restoreLV2State() noexcept override
{
if (fExt.state == nullptr)
return;

LV2_State_Status status = LV2_STATE_ERR_UNKNOWN;

{
const ScopedSingleProcessLocker spl(this, true);

try {
status = fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures);
} catch(...) {}

if (fHandle2 != nullptr)
{
try {
fExt.state->restore(fHandle, carla_lv2_state_retrieve, this, 0, fFeatures);
} catch(...) {}
}
}

switch (status)
{
case LV2_STATE_SUCCESS:
carla_debug("CarlaPluginLV2::updateLV2State() - success");
break;
case LV2_STATE_ERR_UNKNOWN:
carla_stderr("CarlaPluginLV2::updateLV2State() - unknown error");
break;
case LV2_STATE_ERR_BAD_TYPE:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad type");
break;
case LV2_STATE_ERR_BAD_FLAGS:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, bad flags");
break;
case LV2_STATE_ERR_NO_FEATURE:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing feature");
break;
case LV2_STATE_ERR_NO_PROPERTY:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, missing property");
break;
case LV2_STATE_ERR_NO_SPACE:
carla_stderr("CarlaPluginLV2::updateLV2State() - error, insufficient space");
break;
}
}

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

bool isRealtimeSafe() const noexcept


Loading…
Cancel
Save