Browse Source

Re-add tracktion vst fix. Use CARLA_TRACKTION_WORKAROUND env var

tags/1.9.7
falkTX 8 years ago
parent
commit
72b1a13df1
3 changed files with 56 additions and 2 deletions
  1. +27
    -2
      source/backend/engine/CarlaEngineNative.cpp
  2. +2
    -0
      source/native-plugins/resources/carla-plugin
  3. +27
    -0
      source/plugin/carla-vst.cpp

+ 27
- 2
source/backend/engine/CarlaEngineNative.cpp View File

@@ -63,7 +63,8 @@ class CarlaEngineNativeUI : public CarlaExternalUI
{ {
public: public:
CarlaEngineNativeUI(CarlaEngine* const engine) CarlaEngineNativeUI(CarlaEngine* const engine)
: fEngine(engine)
: fEngine(engine),
fIsReady(false)
{ {
carla_debug("CarlaEngineNativeUI::CarlaEngineNativeUI(%p)", engine); carla_debug("CarlaEngineNativeUI::CarlaEngineNativeUI(%p)", engine);
} }
@@ -73,6 +74,11 @@ public:
carla_debug("CarlaEngineNativeUI::~CarlaEngineNativeUI()"); carla_debug("CarlaEngineNativeUI::~CarlaEngineNativeUI()");
} }


bool isReady() const noexcept
{
return fIsReady;
}

protected: protected:
bool msgReceived(const char* const msg) noexcept override bool msgReceived(const char* const msg) noexcept override
{ {
@@ -536,6 +542,10 @@ protected:
if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId)) if (CarlaPlugin* const plugin = fEngine->getPlugin(pluginId))
plugin->showCustomUI(yesNo); plugin->showCustomUI(yesNo);
} }
else if (std::strcmp(msg, "ready") == 0)
{
fIsReady = true;
}
else else
{ {
carla_stderr("CarlaEngineNativeUI::msgReceived : %s", msg); carla_stderr("CarlaEngineNativeUI::msgReceived : %s", msg);
@@ -555,6 +565,7 @@ protected:


private: private:
CarlaEngine* const fEngine; CarlaEngine* const fEngine;
bool fIsReady;


void _updateParamValues(CarlaPlugin* const plugin, const uint32_t pluginId) const noexcept void _updateParamValues(CarlaPlugin* const plugin, const uint32_t pluginId) const noexcept
{ {
@@ -577,7 +588,8 @@ public:
fIsActive(false), fIsActive(false),
fIsRunning(false), fIsRunning(false),
fUiServer(this), fUiServer(this),
fOptionsForced(false)
fOptionsForced(false),
fWaitForReadyMsg(false)
{ {
carla_debug("CarlaEngineNative::CarlaEngineNative()"); carla_debug("CarlaEngineNative::CarlaEngineNative()");


@@ -1498,6 +1510,16 @@ protected:


if (kIsPatchbay) if (kIsPatchbay)
patchbayRefresh(false); patchbayRefresh(false);

if (fWaitForReadyMsg)
{
carla_stdout("Using Carla plugin embedded in Tracktion, waiting for it to be ready...");

for (; fUiServer.isPipeRunning() && ! fUiServer.isReady();)
fUiServer.idlePipe();

carla_stdout("Done!");
}
} }
else else
{ {
@@ -1751,6 +1773,8 @@ public:
switch(opcode) switch(opcode)
{ {
case NATIVE_PLUGIN_OPCODE_NULL: case NATIVE_PLUGIN_OPCODE_NULL:
if (static_cast<uint32_t>(index) == 0xDEADF00D && value == 0xC0C0B00B)
handlePtr->fWaitForReadyMsg = true;
return 0; return 0;
case NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED: case NATIVE_PLUGIN_OPCODE_BUFFER_SIZE_CHANGED:
CARLA_SAFE_ASSERT_RETURN(value > 0, 0); CARLA_SAFE_ASSERT_RETURN(value > 0, 0);
@@ -1794,6 +1818,7 @@ private:
CarlaEngineNativeUI fUiServer; CarlaEngineNativeUI fUiServer;


bool fOptionsForced; bool fOptionsForced;
bool fWaitForReadyMsg;
char fTmpBuf[STR_MAX+1]; char fTmpBuf[STR_MAX+1];


CarlaPlugin* _getFirstPlugin() const noexcept CarlaPlugin* _getFirstPlugin() const noexcept


+ 2
- 0
source/native-plugins/resources/carla-plugin View File

@@ -485,6 +485,8 @@ class CarlaEmbedW(QEmbedWidget):
self.addWidget(self.gui.centralWidget()) self.addWidget(self.gui.centralWidget())
self.finalSetup(self.gui, winId) self.finalSetup(self.gui, winId)


self.gui.send(["ready"])

def addShortcutActions(self, actions): def addShortcutActions(self, actions):
for action in actions: for action in actions:
if not action.shortcut().isEmpty(): if not action.shortcut().isEmpty():


+ 27
- 0
source/plugin/carla-vst.cpp View File

@@ -275,12 +275,39 @@ public:
// set CARLA_PLUGIN_EMBED_WINID for external process // set CARLA_PLUGIN_EMBED_WINID for external process
carla_setenv("CARLA_PLUGIN_EMBED_WINID", strBuf); carla_setenv("CARLA_PLUGIN_EMBED_WINID", strBuf);


// check if vst host is an old version of tracktion
bool oldTracktionWorkaround = false;

// tracktion doesn't export its version properly, use env var instead
if (std::getenv("CARLA_TRACKTION_WORKAROUND") != nullptr)
{
carla_zeroChars(strBuf, 0xff+1);
hostCallback(audioMasterGetProductString, 0, 0, strBuf, 0.0f);
oldTracktionWorkaround = (std::strcmp(strBuf, "Tracktion") == 0);

// if vst host is old tracktion, delay UI appearance for a bit (part 1)
if (oldTracktionWorkaround)
fDescriptor->dispatcher(fHandle, NATIVE_PLUGIN_OPCODE_NULL, (int32_t)0xDEADF00D, 0xC0C0B00B, nullptr, 0.0f);
}

// show UI now // show UI now
fDescriptor->ui_show(fHandle, true); fDescriptor->ui_show(fHandle, true);


// reset CARLA_PLUGIN_EMBED_WINID just in case // reset CARLA_PLUGIN_EMBED_WINID just in case
carla_setenv("CARLA_PLUGIN_EMBED_WINID", "0"); carla_setenv("CARLA_PLUGIN_EMBED_WINID", "0");


// if vst host is old tracktion, delay UI appearance for a bit (part 2)
if (oldTracktionWorkaround)
{
carla_stdout("Old Tracktion detected, delaying UI appearance so it works properly...");

for (int x=10; --x>=0;)
{
hostCallback(audioMasterIdle);
carla_msleep(25);
}
}

ret = 1; ret = 1;
} }
break; break;


Loading…
Cancel
Save