@@ -262,6 +262,13 @@ public: | |||||
*/ | */ | ||||
const CustomData& getCustomData(const uint32_t index) const noexcept; | 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; | |||||
/*! | /*! | ||||
* Get the complete plugin chunk data into @a dataPtr. | * Get the complete plugin chunk data into @a dataPtr. | ||||
* | * | ||||
@@ -764,7 +764,9 @@ public: | |||||
const uint32_t valueSize(fShmNonRtClientControl.readUInt()); | const uint32_t valueSize(fShmNonRtClientControl.readUInt()); | ||||
char valueStr[valueSize+1]; | char valueStr[valueSize+1]; | ||||
carla_zeroChars(valueStr, valueSize+1); | carla_zeroChars(valueStr, valueSize+1); | ||||
fShmNonRtClientControl.readCustomData(valueStr, valueSize); | |||||
if (valueSize > 0) | |||||
fShmNonRtClientControl.readCustomData(valueStr, valueSize); | |||||
if (plugin != nullptr && plugin->isEnabled()) | if (plugin != nullptr && plugin->isEnabled()) | ||||
plugin->setCustomData(typeStr, keyStr, valueStr, true); | plugin->setCustomData(typeStr, keyStr, valueStr, true); | ||||
@@ -269,6 +269,10 @@ const CustomData& CarlaPlugin::getCustomData(const uint32_t index) const noexcep | |||||
return pData->custom.getAt(index, kCustomDataFallback); | return pData->custom.getAt(index, kCustomDataFallback); | ||||
} | } | ||||
void CarlaPlugin::updateCustomData() noexcept | |||||
{ | |||||
} | |||||
std::size_t CarlaPlugin::getChunkData(void** const dataPtr) noexcept | std::size_t CarlaPlugin::getChunkData(void** const dataPtr) noexcept | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0); | CARLA_SAFE_ASSERT_RETURN(dataPtr != nullptr, 0); | ||||
@@ -603,6 +607,8 @@ const CarlaStateSave& CarlaPlugin::getStateSave(const bool callPrepareForSave) | |||||
// --------------------------------------------------------------- | // --------------------------------------------------------------- | ||||
// Custom Data | // Custom Data | ||||
updateCustomData(); | |||||
for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next()) | for (LinkedList<CustomData>::Itenerator it = pData->custom.begin2(); it.valid(); it.next()) | ||||
{ | { | ||||
const CustomData& cData(it.getValue(kCustomDataFallback)); | const CustomData& cData(it.getValue(kCustomDataFallback)); | ||||
@@ -477,7 +477,10 @@ public: | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
// Information (current data) | // Information (current data) | ||||
// TODO - missing getCustomData | |||||
void updateCustomData() noexcept override | |||||
{ | |||||
waitForSaved(); | |||||
} | |||||
std::size_t getChunkData(void** const dataPtr) noexcept override | std::size_t getChunkData(void** const dataPtr) noexcept override | ||||
{ | { | ||||
@@ -816,7 +819,9 @@ public: | |||||
fShmNonRtClientControl.writeCustomData(key, keyLen); | fShmNonRtClientControl.writeCustomData(key, keyLen); | ||||
fShmNonRtClientControl.writeUInt(valueLen); | fShmNonRtClientControl.writeUInt(valueLen); | ||||
fShmNonRtClientControl.writeCustomData(value, valueLen); | |||||
if (valueLen > 0) | |||||
fShmNonRtClientControl.writeCustomData(value, valueLen); | |||||
fShmNonRtClientControl.commitWrite(); | fShmNonRtClientControl.commitWrite(); | ||||
} | } | ||||