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