1
Fork 0

Add extra, simple text string to be part of plugin state

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2022-02-01 12:52:02 +00:00
parent fdd39cbacc
commit 47ac677388
No known key found for this signature in database
GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 29 additions and 5 deletions

2
carla

@ -1 +1 @@
Subproject commit 25282c45fe6d199f7f02062877d0b62ace9caa8e
Subproject commit afc25ae3137be9cb7addedd16ff45fbe0ab4ea97

2
dpf

@ -1 +1 @@
Subproject commit e9f41ad9979d35d7f747ec25652e5ff25da8e853
Subproject commit 7e6e3cc84b60727599120a8756396caa2919d46e

View File

@ -49,10 +49,10 @@
#ifndef HEADLESS
# include "WindowParameters.hpp"
static const constexpr uint kCardinalStateCount = 2; // patch, windowSize
static const constexpr uint kCardinalStateCount = 3; // patch, text, windowSize
#else
# define kWindowParameterCount 0
static const constexpr uint kCardinalStateCount = 1; // patch
static const constexpr uint kCardinalStateCount = 2; // patch, text
#endif
namespace rack {
@ -396,6 +396,7 @@ class CardinalPlugin : public CardinalBasePlugin
std::string fAutosavePath;
uint64_t fPreviousFrame;
String fStateText;
String fWindowSize;
#ifndef HEADLESS
@ -696,14 +697,28 @@ protected:
case 0:
stateKey = "patch";
break;
#ifndef HEADLESS
case 1:
stateKey = "text";
break;
#ifndef HEADLESS
case 2:
stateKey = "windowSize";
break;
#endif
}
}
uint32_t getStateHints(const uint32_t index) override
{
switch (index)
{
case 1:
return kStateIsHostVisible;
default:
return 0x0;
}
}
/* --------------------------------------------------------------------------------------------------------
* Internal data */
@ -748,6 +763,9 @@ protected:
return fWindowSize;
#endif
if (std::strcmp(key, "text") == 0)
return fStateText;
if (std::strcmp(key, "patch") != 0)
return String();
if (fAutosavePath.empty())
@ -781,6 +799,12 @@ protected:
}
#endif
if (std::strcmp(key, "text") == 0)
{
fStateText = value;
return;
}
if (std::strcmp(key, "patch") != 0)
return;
if (fAutosavePath.empty())