Browse Source

Carla: Implement restore chunk data for bridges

tags/v0.9.0
falkTX 13 years ago
parent
commit
4fbb632e2c
3 changed files with 36 additions and 8 deletions
  1. +5
    -1
      c++/carla-backend/carla_bridge.cpp
  2. +2
    -1
      c++/carla-backend/vst.cpp
  3. +29
    -6
      c++/carla-bridge/carla_bridge_plugin.cpp

+ 5
- 1
c++/carla-backend/carla_bridge.cpp View File

@@ -706,6 +706,7 @@ public:
if (chunkFile.open(QIODevice::ReadOnly)) if (chunkFile.open(QIODevice::ReadOnly))
{ {
info.chunk = chunkFile.readAll(); info.chunk = chunkFile.readAll();
chunkFile.close();
chunkFile.remove(); chunkFile.remove();
} }


@@ -777,9 +778,12 @@ public:
Q_ASSERT(stringData); Q_ASSERT(stringData);


QString filePath; QString filePath;
filePath += "/tmp/.CarlaChunk_"; // FIXME - cross-platform
filePath = QDir::tempPath();
filePath += "/.CarlaChunk_";
filePath += m_name; filePath += m_name;


filePath = QDir::toNativeSeparators(filePath);

QFile file(filePath); QFile file(filePath);


if (file.open(QIODevice::WriteOnly | QIODevice::Text)) if (file.open(QIODevice::WriteOnly | QIODevice::Text))


+ 2
- 1
c++/carla-backend/vst.cpp View File

@@ -1927,9 +1927,10 @@ public:
#endif #endif


case audioMasterGetCurrentProcessLevel: case audioMasterGetCurrentProcessLevel:
Q_ASSERT(self);
if (self) if (self)
{
ret = self->handleAudioMasterGetCurrentProcessLevel(); ret = self->handleAudioMasterGetCurrentProcessLevel();
}
else else
{ {
qWarning("VstPlugin::hostCallback::audioMasterGetCurrentProcessLevel called without valid object"); qWarning("VstPlugin::hostCallback::audioMasterGetCurrentProcessLevel called without valid object");


+ 29
- 6
c++/carla-bridge/carla_bridge_plugin.cpp View File

@@ -22,6 +22,7 @@


#include <QtCore/QDir> #include <QtCore/QDir>
#include <QtCore/QFile> #include <QtCore/QFile>
#include <QtCore/QTextStream>
#include <QtCore/QTimerEvent> #include <QtCore/QTimerEvent>
#include <QtGui/QApplication> #include <QtGui/QApplication>
#include <QtGui/QDialog> #include <QtGui/QDialog>
@@ -495,14 +496,10 @@ public:
if (! plugin) if (! plugin)
return; return;


Q_UNUSED(filePath);
nextChunkFilePath = QString(filePath);


#if 0
nextChunkFilePath = strdup(filePath);

while (nextChunkFilePath)
while (! nextChunkFilePath.isEmpty())
carla_msleep(25); carla_msleep(25);
#endif
} }


// --------------------------------------------------------------------- // ---------------------------------------------------------------------
@@ -599,6 +596,31 @@ protected:


if (event->timerId() == msgTimer) 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) if (nextWidth > 0 && nextHeight > 0 && pluginGui)
{ {
pluginGui->setNewSize(nextWidth, nextHeight); pluginGui->setNewSize(nextWidth, nextHeight);
@@ -625,6 +647,7 @@ protected:
private: private:
int msgTimer; int msgTimer;
int nextWidth, nextHeight; int nextWidth, nextHeight;
QString nextChunkFilePath;


CarlaBackend::CarlaEngine* engine; CarlaBackend::CarlaEngine* engine;
CarlaBackend::CarlaPlugin* plugin; CarlaBackend::CarlaPlugin* plugin;


Loading…
Cancel
Save