Browse Source

Carla: More fixing on VST and bridges

tags/v0.9.0
falkTX 13 years ago
parent
commit
da214bad8f
7 changed files with 71 additions and 21 deletions
  1. +5
    -0
      c++/carla-backend/carla_engine.cpp
  2. +1
    -0
      c++/carla-backend/carla_engine.h
  3. +15
    -0
      c++/carla-backend/carla_osc.cpp
  4. +1
    -0
      c++/carla-backend/carla_osc.h
  5. +4
    -0
      c++/carla-backend/carla_threads.cpp
  6. +21
    -1
      c++/carla-backend/vst.cpp
  7. +24
    -20
      c++/carla-bridge/carla_bridge_plugin.cpp

+ 5
- 0
c++/carla-backend/carla_engine.cpp View File

@@ -799,6 +799,11 @@ bool CarlaEngine::isOscControlRegisted() const
}

#ifndef BUILD_BRIDGE
void CarlaEngine::oscWaitEvents()
{
m_osc.waitForEvents();
}

const char* CarlaEngine::getOscServerPathTCP() const
{
return m_osc.getServerPathTCP();


+ 1
- 0
c++/carla-backend/carla_engine.h View File

@@ -269,6 +269,7 @@ public:
bool isOscControlRegisted() const;

#ifndef BUILD_BRIDGE
void oscWaitEvents();
const char* getOscServerPathTCP() const;
const char* getOscServerPathUDP() const;
#else


+ 15
- 0
c++/carla-backend/carla_osc.cpp View File

@@ -123,6 +123,21 @@ void CarlaOsc::close()
m_nameSize = 0;
}

void CarlaOsc::waitForEvents()
{
if (m_serverThreadTCP)
{
while (lo_server_thread_events_pending(m_serverThreadTCP))
carla_msleep(10);
}

if (m_serverThreadUDP)
{
while (lo_server_thread_events_pending(m_serverThreadUDP))
carla_msleep(10);
}
}

// -----------------------------------------------------------------------

int CarlaOsc::handleMessage(const char* const path, const int argc, const lo_arg* const* const argv, const char* const types, const lo_message msg)


+ 1
- 0
c++/carla-backend/carla_osc.h View File

@@ -57,6 +57,7 @@ public:

void init(const char* const name);
void close();
void waitForEvents();

// -------------------------------------------------------------------



+ 4
- 0
c++/carla-backend/carla_threads.cpp View File

@@ -79,6 +79,10 @@ void CarlaCheckThread::run()
const ScopedLocker m(this);
oscControlRegisted = engine->isOscControlRegisted();

#ifndef BUILD_BRIDGE
engine->oscWaitEvents();
#endif

for (unsigned short i=0; i < maxPluginNumber; i++)
{
CarlaPlugin* const plugin = engine->getPluginUnchecked(i);


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

@@ -1056,6 +1056,8 @@ public:
sendMidiAllNotesOff();

effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);

postponeEvent(PluginPostEventParameterChange, PARAMETER_ACTIVE, 0, 0.0);
@@ -1237,6 +1239,7 @@ public:
memset(m_latencyBuffers[i], 0, sizeof(float)*m_latency);
}

effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
}

@@ -1273,7 +1276,10 @@ public:
else
{
if (m_activeBefore)
{
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
}
}

CARLA_PROCESS_CONTINUE_CHECK;
@@ -1409,7 +1415,10 @@ public:
void bufferSizeChanged(uint32_t newBufferSize)
{
if (m_active)
{
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
}

#if ! VST_FORCE_DEPRECATED
effect->dispatcher(effect, effSetBlockSizeAndSampleRate, 0, newBufferSize, nullptr, x_engine->getSampleRate());
@@ -1417,7 +1426,10 @@ public:
effect->dispatcher(effect, effSetBlockSize, 0, newBufferSize, nullptr, 0.0f);

if (m_active)
{
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
}
}

// -------------------------------------------------------------------
@@ -1603,12 +1615,18 @@ public:
engineProcessUnlock();

if (m_active)
{
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
}

reload();

if (m_active)
{
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
}

x_engine->callback(CALLBACK_RELOAD_ALL, m_id, 0, 0, 0.0);

@@ -2222,7 +2240,7 @@ public:
#endif

effect->dispatcher(effect, effOpen, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);

// ---------------------------------------------------------------
// get info
@@ -2267,8 +2285,10 @@ public:

#if ! VST_FORCE_DEPRECATED
// dummy pre-start to catch possible wantEvents() call on old plugins
effect->dispatcher(effect, effMainsChanged, 0, 1, nullptr, 0.0f);
effect->dispatcher(effect, effStartProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effStopProcess, 0, 0, nullptr, 0.0f);
effect->dispatcher(effect, effMainsChanged, 0, 0, nullptr, 0.0f);
#endif

// special checks


+ 24
- 20
c++/carla-bridge/carla_bridge_plugin.cpp View File

@@ -20,6 +20,7 @@
#include "carla_bridge_client.h"
#include "carla_plugin.h"

#include <set>
#include <QtCore/QDir>
#include <QtCore/QFile>
#include <QtCore/QTextStream>
@@ -225,9 +226,6 @@ public:
msgTimerGUI = 0;
msgTimerOSC = 0;

nextWidth = 0;
nextHeight = 0;

engine = nullptr;
plugin = nullptr;
pluginGui = nullptr;
@@ -555,6 +553,9 @@ public:
switch (action)
{
case CarlaBackend::CALLBACK_PARAMETER_VALUE_CHANGED:
#if 0
parametersToUpdate.insert(value1);
#endif
engine->osc_send_bridge_set_parameter_value(value1, value3);
break;

@@ -587,17 +588,11 @@ public:

case CarlaBackend::CALLBACK_RESIZE_GUI:
CARLA_ASSERT(value1 > 0 && value2 > 0);
if (value3 == 1.0)
{
nextWidth = 0;
nextHeight = 0;
pluginGui->setFixedSize(value1, value2);
}
else if (nextWidth != value1 && nextHeight != value2)
{
nextWidth = value1;
nextHeight = value2;
}
CARLA_ASSERT(pluginGui);

if (value1 > 0 && value2 > 0 && pluginGui)
pluginGui->setNewSize(value1, value2);

break;

case CarlaBackend::CALLBACK_RELOAD_PARAMETERS:
@@ -617,7 +612,6 @@ public:
default:
break;
}
Q_UNUSED(value3);
}

// ---------------------------------------------------------------------
@@ -636,6 +630,8 @@ public:
protected:
void guiClosedCallback()
{
if (engine)
engine->osc_send_bridge_configure(CarlaBackend::CARLA_BRIDGE_MSG_HIDE_GUI, "");
}

void timerEvent(QTimerEvent* const event)
@@ -645,12 +641,18 @@ protected:

if (event->timerId() == msgTimerGUI)
{
if (nextWidth > 0 && nextHeight > 0 && pluginGui)
#if 0
if (parametersToUpdate.size() > 0)
{
pluginGui->setNewSize(nextWidth, nextHeight);
nextWidth = 0;
nextHeight = 0;
for (auto it = parametersToUpdate.begin(); it != parametersToUpdate.end(); it++)
{
const int32_t paramId(*it);
engine->osc_send_bridge_set_parameter_value(paramId, plugin->getParameterValue(paramId));
}

parametersToUpdate.clear();
}
#endif

if (plugin)
plugin->idleGui();
@@ -673,7 +675,9 @@ protected:
private:
bool hasUI;
int msgTimerGUI, msgTimerOSC;
int nextWidth, nextHeight;
#if 0
std::set<int32_t> parametersToUpdate;
#endif

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


Loading…
Cancel
Save