Use host idle call to give idle to Carla and Ildaeil, fixes GL UIs

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2021-11-13 12:56:08 +00:00
parent e76a8024e1
commit d13e354728
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
5 changed files with 172 additions and 61 deletions

View file

@ -54,6 +54,9 @@ struct CardinalPluginContext : rack::Context {
const float** dataIns;
float** dataOuts;
Plugin* const plugin;
#ifndef HEADLESS
UI* ui;
#endif
CardinalPluginContext(Plugin* const p)
: bufferSize(p->getBufferSize()),
@ -79,9 +82,17 @@ struct CardinalPluginContext : rack::Context {
dataIns(nullptr),
dataOuts(nullptr),
plugin(p)
#ifndef HEADLESS
, ui(nullptr)
#endif
{
std::memset(parameters, 0, sizeof(parameters));
}
#ifndef HEADLESS
bool addIdleCallback(IdleCallback* cb);
void removeIdleCallback(IdleCallback* cb);
#endif
};
// -----------------------------------------------------------------------------------------------------------
@ -121,8 +132,14 @@ public:
CardinalBaseUI(const uint width, const uint height)
: UI(width, height),
context(getRackContextFromPlugin(getPluginInstancePointer())),
saving(false) {}
~CardinalBaseUI() override {}
saving(false)
{
context->ui = this;
}
~CardinalBaseUI() override
{
context->ui = nullptr;
}
};
#endif