diff --git a/c++/carla-backend/carla_bridge.cpp b/c++/carla-backend/carla_bridge.cpp index 7fd3724..a861fe5 100644 --- a/c++/carla-backend/carla_bridge.cpp +++ b/c++/carla-backend/carla_bridge.cpp @@ -706,6 +706,7 @@ public: if (chunkFile.open(QIODevice::ReadOnly)) { info.chunk = chunkFile.readAll(); + chunkFile.close(); chunkFile.remove(); } @@ -777,9 +778,12 @@ public: Q_ASSERT(stringData); QString filePath; - filePath += "/tmp/.CarlaChunk_"; // FIXME - cross-platform + filePath = QDir::tempPath(); + filePath += "/.CarlaChunk_"; filePath += m_name; + filePath = QDir::toNativeSeparators(filePath); + QFile file(filePath); if (file.open(QIODevice::WriteOnly | QIODevice::Text)) diff --git a/c++/carla-backend/vst.cpp b/c++/carla-backend/vst.cpp index 5e33b20..eace021 100644 --- a/c++/carla-backend/vst.cpp +++ b/c++/carla-backend/vst.cpp @@ -1927,9 +1927,10 @@ public: #endif case audioMasterGetCurrentProcessLevel: - Q_ASSERT(self); if (self) + { ret = self->handleAudioMasterGetCurrentProcessLevel(); + } else { qWarning("VstPlugin::hostCallback::audioMasterGetCurrentProcessLevel called without valid object"); diff --git a/c++/carla-bridge/carla_bridge_plugin.cpp b/c++/carla-bridge/carla_bridge_plugin.cpp index 55c4370..284bb2a 100644 --- a/c++/carla-bridge/carla_bridge_plugin.cpp +++ b/c++/carla-bridge/carla_bridge_plugin.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -495,14 +496,10 @@ public: if (! plugin) return; - Q_UNUSED(filePath); + nextChunkFilePath = QString(filePath); -#if 0 - nextChunkFilePath = strdup(filePath); - - while (nextChunkFilePath) + while (! nextChunkFilePath.isEmpty()) carla_msleep(25); -#endif } // --------------------------------------------------------------------- @@ -599,6 +596,31 @@ protected: if (event->timerId() == msgTimer) { + if (! nextChunkFilePath.isEmpty()) + { +#ifdef Q_OS_WIN + if (nextChunkFilePath.startsWith("/")) + { + // running under Wine, posix host + nextChunkFilePath = nextChunkFilePath.replace(0, 1, "Z:/"); + nextChunkFilePath = QDir::toNativeSeparators(nextChunkFilePath); + } +#endif + QFile chunkFile(nextChunkFilePath); + + if (plugin && chunkFile.open(QIODevice::ReadOnly | QIODevice::Text)) + { + QTextStream in(&chunkFile); + QString stringData(in.readAll()); + chunkFile.close(); + chunkFile.remove(); + + plugin->setChunkData(stringData.toUtf8().constData()); + } + + nextChunkFilePath.clear(); + } + if (nextWidth > 0 && nextHeight > 0 && pluginGui) { pluginGui->setNewSize(nextWidth, nextHeight); @@ -625,6 +647,7 @@ protected: private: int msgTimer; int nextWidth, nextHeight; + QString nextChunkFilePath; CarlaBackend::CarlaEngine* engine; CarlaBackend::CarlaPlugin* plugin;