Browse Source

Continue rework

tags/v0.9.0
falkTX 12 years ago
parent
commit
b2da053ebf
23 changed files with 2133 additions and 1874 deletions
  1. +34
    -78
      c++/carla-backend/carla_backend_utils.hpp
  2. +39
    -0
      c++/carla-engine/carla_engine.cpp
  3. +1
    -1
      c++/carla-engine/carla_engine.doxygen
  4. +8
    -3
      c++/carla-engine/carla_engine.hpp
  5. +9
    -7
      c++/carla-engine/carla_engine.pro
  6. +156
    -0
      c++/carla-engine/carla_engine_thread.cpp
  7. +71
    -0
      c++/carla-engine/carla_engine_thread.hpp
  8. +0
    -61
      c++/carla-engine/carla_shared.hpp
  9. +0
    -111
      c++/carla-engine/carla_threads.hpp
  10. +10
    -8
      c++/carla-plugin/Makefile
  11. +26
    -5
      c++/carla-plugin/carla_bridge.cpp
  12. +1543
    -0
      c++/carla-plugin/carla_plugin.cpp
  13. +97
    -1383
      c++/carla-plugin/carla_plugin.hpp
  14. +12
    -9
      c++/carla-plugin/carla_plugin.pro
  15. +6
    -150
      c++/carla-plugin/carla_plugin_thread.cpp
  16. +61
    -0
      c++/carla-plugin/carla_plugin_thread.hpp
  17. +10
    -10
      c++/carla-plugin/dssi.cpp
  18. +4
    -4
      c++/carla-plugin/fluidsynth.cpp
  19. +7
    -7
      c++/carla-plugin/ladspa.cpp
  20. +7
    -7
      c++/carla-plugin/linuxsampler.cpp
  21. +18
    -16
      c++/carla-plugin/lv2.cpp
  22. +8
    -8
      c++/carla-plugin/native.cpp
  23. +6
    -6
      c++/carla-plugin/vst.cpp

c++/carla-engine/carla_shared.cpp → c++/carla-backend/carla_backend_utils.hpp View File

@@ -15,22 +15,20 @@
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "carla_shared.hpp"
#include "carla_engine.hpp"
#ifndef CARLA_BACKEND_UTILS_HPP
#define CARLA_BACKEND_UTILS_HPP

//#ifndef BUILD_BRIDGE
//# include "carla_native.h"
//#endif
#include "carla_backend.hpp"

#include <QtCore/QString>

CARLA_BACKEND_START_NAMESPACE

static const char* carlaLastError = nullptr;
class CarlaEngine;
class CarlaPlugin;

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

const char* BinaryType2str(const BinaryType type)
static inline
const char* BinaryType2Str(const BinaryType type)
{
switch (type)
{
@@ -52,7 +50,8 @@ const char* BinaryType2str(const BinaryType type)
return nullptr;
}

const char* PluginType2str(const PluginType type)
static inline
const char* PluginType2Str(const PluginType type)
{
switch (type)
{
@@ -80,7 +79,8 @@ const char* PluginType2str(const PluginType type)
return nullptr;
}

const char* PluginCategory2str(const PluginCategory category)
static inline
const char* PluginCategory2Str(const PluginCategory category)
{
switch (category)
{
@@ -108,7 +108,8 @@ const char* PluginCategory2str(const PluginCategory category)
return nullptr;
}

const char* ParameterType2str(const ParameterType type)
static inline
const char* ParameterType2Str(const ParameterType type)
{
switch (type)
{
@@ -132,7 +133,8 @@ const char* ParameterType2str(const ParameterType type)
return nullptr;
}

const char* InternalParametersIndex2str(const InternalParametersIndex index)
static inline
const char* InternalParametersIndex2Str(const InternalParametersIndex index)
{
switch (index)
{
@@ -154,7 +156,8 @@ const char* InternalParametersIndex2str(const InternalParametersIndex index)
return nullptr;
}

const char* CustomDataType2str(const CustomDataType type)
static inline
const char* CustomDataType2Str(const CustomDataType type)
{
switch (type)
{
@@ -174,7 +177,8 @@ const char* CustomDataType2str(const CustomDataType type)
return nullptr;
}

const char* GuiType2str(const GuiType type)
static inline
const char* GuiType2Str(const GuiType type)
{
switch (type)
{
@@ -200,7 +204,8 @@ const char* GuiType2str(const GuiType type)
return nullptr;
}

const char* OptionsType2str(const OptionsType type)
static inline
const char* OptionsType2Str(const OptionsType type)
{
switch (type)
{
@@ -266,7 +271,8 @@ const char* OptionsType2str(const OptionsType type)
return nullptr;
}

const char* CallbackType2str(const CallbackType type)
static inline
const char* CallbackType2Str(const CallbackType type)
{
switch (type)
{
@@ -318,7 +324,8 @@ const char* CallbackType2str(const CallbackType type)
return nullptr;
}

const char* ProcessModeType2str(const ProcessModeType type)
static inline
const char* ProcessModeType2Str(const ProcessModeType type)
{
switch (type)
{
@@ -336,6 +343,7 @@ const char* ProcessModeType2str(const ProcessModeType type)

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

static inline
CustomDataType getCustomDataStringType(const char* const stype)
{
qDebug("CarlaBackend::getCustomDataStringType(\"%s\")", stype);
@@ -351,9 +359,10 @@ CustomDataType getCustomDataStringType(const char* const stype)
return CUSTOM_DATA_INVALID;
}

static inline
const char* getCustomDataTypeString(const CustomDataType type)
{
qDebug("CarlaBackend::getCustomDataTypeString(%s)", CustomDataType2str(type));
qDebug("CarlaBackend::getCustomDataTypeString(%s)", CustomDataType2Str(type));

switch (type)
{
@@ -370,30 +379,10 @@ const char* getCustomDataTypeString(const CustomDataType type)
}
}

const char* getBinaryBidgePath(const BinaryType type)
{
qDebug("CarlaBackend::getBinaryBidgePath(%s)", BinaryType2str(type));

switch (type)
{
#ifndef BUILD_BRIDGE
// case BINARY_POSIX32:
// return CarlaEngine::options.bridge_posix32;
// case BINARY_POSIX64:
// return CarlaEngine::options.bridge_posix64;
// case BINARY_WIN32:
// return CarlaEngine::options.bridge_win32;
// case BINARY_WIN64:
// return CarlaEngine::options.bridge_win64;
#endif
default:
return nullptr;
}
}

static inline
const char* getPluginTypeString(const PluginType type)
{
qDebug("CarlaBackend::getPluginTypeString(%s)", PluginType2str(type));
qDebug("CarlaBackend::getPluginTypeString(%s)", PluginType2Str(type));

switch (type)
{
@@ -422,6 +411,7 @@ const char* getPluginTypeString(const PluginType type)

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

static inline
void* getPointer(const uintptr_t addr)
{
CARLA_ASSERT(addr != 0);
@@ -431,6 +421,7 @@ void* getPointer(const uintptr_t addr)
return (void*)ptr;
}

static inline
PluginCategory getPluginCategoryFromName(const char* const name)
{
CARLA_ASSERT(name);
@@ -506,41 +497,6 @@ PluginCategory getPluginCategoryFromName(const char* const name)
return PLUGIN_CATEGORY_NONE;
}

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

const char* getLastError()
{
qDebug("CarlaBackend::getLastError()");

return carlaLastError;
}

void setLastError(const char* const error)
{
qDebug("CarlaBackend::setLastError(\"%s\")", error);

if (carlaLastError)
free((void*)carlaLastError);

carlaLastError = error ? strdup(error) : nullptr;
}

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

#ifndef BUILD_BRIDGE
uint32_t getPluginHintsFromNative(const uint32_t nativeHints)
{
uint32_t realHints = 0;

// if (nativeHints & ::PLUGIN_IS_SYNTH)
// realHints |= PLUGIN_IS_SYNTH;
// if (nativeHints & ::PLUGIN_HAS_GUI)
// realHints |= PLUGIN_HAS_GUI;
// if (nativeHints & ::PLUGIN_USES_SINGLE_THREAD)
// realHints |= PLUGIN_USES_SINGLE_THREAD;

return realHints;
}
#endif // BUILD_BRIDGE

CARLA_BACKEND_END_NAMESPACE

#endif // CARLA_BACKEND_UTILS_HPP

+ 39
- 0
c++/carla-engine/carla_engine.cpp View File

@@ -34,6 +34,45 @@ double abs_d(const double& value)
return (value < 0.0) ? -value : value;
}

static const char* carlaLastError = nullptr;

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

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

const char* getLastError()
{
qDebug("CarlaBackend::getLastError()");

return carlaLastError;
}

void setLastError(const char* const error)
{
qDebug("CarlaBackend::setLastError(\"%s\")", error);

if (carlaLastError)
free((void*)carlaLastError);

carlaLastError = error ? strdup(error) : nullptr;
}

#ifndef BUILD_BRIDGE
uint32_t getPluginHintsFromNative(const uint32_t nativeHints)
{
uint32_t realHints = 0;

// if (nativeHints & ::PLUGIN_IS_SYNTH)
// realHints |= PLUGIN_IS_SYNTH;
// if (nativeHints & ::PLUGIN_HAS_GUI)
// realHints |= PLUGIN_HAS_GUI;
// if (nativeHints & ::PLUGIN_USES_SINGLE_THREAD)
// realHints |= PLUGIN_USES_SINGLE_THREAD;

return realHints;
}
#endif // BUILD_BRIDGE

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

unsigned short CarlaEngine::m_maxPluginNumber = 0;


+ 1
- 1
c++/carla-engine/carla_engine.doxygen View File

@@ -4,7 +4,7 @@
# Project related configuration options
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Carla Native"
PROJECT_NAME = "Carla Engine"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =


+ 8
- 3
c++/carla-engine/carla_engine.hpp View File

@@ -19,8 +19,7 @@
#define CARLA_ENGINE_HPP

#include "carla_engine_osc.hpp"
#include "carla_shared.hpp" // FIXME - remove
#include "carla_threads.hpp" // FIXME - remove
#include "carla_engine_thread.hpp"

#ifdef CARLA_ENGINE_JACK
typedef struct _jack_client jack_client_t;
@@ -315,6 +314,12 @@ public:
void callback(const CallbackType action, const unsigned short pluginId, const int value1, const int value2, const double value3);
void setCallback(const CallbackFunc func, void* const ptr);

// -------------------------------------------------------------------
// Error handling

void setLastError(const char* error);
const char* getLastError();

// -------------------------------------------------------------------
// Mutex locks

@@ -445,7 +450,7 @@ protected:
void startCheckThread();

private:
CarlaCheckThread m_checkThread;
CarlaEngineThread m_thread;

#ifndef BUILD_BRIDGE
CarlaEngineOsc m_osc;


+ 9
- 7
c++/carla-engine/carla_engine.pro View File

@@ -21,19 +21,21 @@ TEMPLATE = lib
VERSION = 0.5.0

SOURCES = \
carla_engine.cpp \
carla_engine_osc.cpp \
jack.cpp \
rtaudio.cpp
carla_engine.cpp \
carla_engine_osc.cpp \
carla_engine_thread.cpp \
jack.cpp \
rtaudio.cpp

# FIXME - remove these
SOURCES += \
carla_shared.cpp \
carla_threads.cpp
carla_shared.cpp \
carla_threads.cpp

HEADERS = \
carla_engine.hpp \
carla_engine_osc.hpp
carla_engine_osc.hpp \
carla_engine_thread.hpp

INCLUDEPATH = . \
../carla-backend \


+ 156
- 0
c++/carla-engine/carla_engine_thread.cpp View File

@@ -0,0 +1,156 @@
/*
* Carla Engine
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "carla_engine_thread.hpp"
#include "carla_plugin.hpp"

CarlaCheckThread::CarlaCheckThread(CarlaBackend::CarlaEngine* const engine_, QObject* const parent)
: QThread(parent),
engine(engine_)
{
qDebug("CarlaCheckThread::CarlaCheckThread(%p, %p)", engine, parent);
CARLA_ASSERT(engine);
}

CarlaCheckThread::~CarlaCheckThread()
{
qDebug("CarlaCheckThread::~CarlaCheckThread()");
}

void CarlaCheckThread::startNow()
{
qDebug("CarlaCheckThread::startNow()");
start(QThread::HighPriority);
}

void CarlaCheckThread::stopNow()
{
if (m_stopNow)
return;

m_stopNow = true;

// TESTING - let processing finish first
QMutexLocker(&this->mutex); // FIXME

if (isRunning() && ! wait(200))
{
quit();

if (isRunning() && ! wait(300))
terminate();
}
}

void CarlaCheckThread::run()
{
qDebug("CarlaCheckThread::run()");

using namespace CarlaBackend;

bool oscControlRegisted, usesSingleThread;
unsigned short id, maxPluginNumber = CarlaEngine::maxPluginNumber();
double value;

m_stopNow = false;

while (engine->isRunning() && ! m_stopNow)
{
const ScopedLocker m(this);
oscControlRegisted = engine->isOscControlRegisted();

#ifndef BUILD_BRIDGE
if (engine->getType() != CarlaEngineTypePlugin)
engine->oscWaitEvents();
#endif

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

if (plugin && plugin->enabled())
{
id = plugin->id();
usesSingleThread = (plugin->hints() & PLUGIN_USES_SINGLE_THREAD);

// -------------------------------------------------------
// Process postponed events

if (! usesSingleThread)
plugin->postEventsRun();

// -------------------------------------------------------
// Update parameter outputs

if (oscControlRegisted || ! usesSingleThread)
{
for (uint32_t i=0; i < plugin->parameterCount(); i++)
{
if (plugin->parameterIsOutput(i))
{
value = plugin->getParameterValue(i);

// Update UI
if (! usesSingleThread)
plugin->uiParameterChange(i, value);

// Update OSC control client
if (oscControlRegisted)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_parameter_value(i, value);
#else
engine->osc_send_control_set_parameter_value(id, i, value);
#endif
}
}
}
}

// -------------------------------------------------------
// Update OSC control client

if (oscControlRegisted)
{
// Peak values
if (plugin->audioInCount() > 0)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_inpeak(1, engine->getInputPeak(id, 0));
engine->osc_send_bridge_set_inpeak(2, engine->getInputPeak(id, 1));
#else
engine->osc_send_control_set_input_peak_value(id, 1, engine->getInputPeak(id, 0));
engine->osc_send_control_set_input_peak_value(id, 2, engine->getInputPeak(id, 1));
#endif
}
if (plugin->audioOutCount() > 0)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_outpeak(1, engine->getOutputPeak(id, 0));
engine->osc_send_bridge_set_outpeak(2, engine->getOutputPeak(id, 1));
#else
engine->osc_send_control_set_output_peak_value(id, 1, engine->getOutputPeak(id, 0));
engine->osc_send_control_set_output_peak_value(id, 2, engine->getOutputPeak(id, 1));
#endif
}
}
}
}

msleep(50);
}
}

+ 71
- 0
c++/carla-engine/carla_engine_thread.hpp View File

@@ -0,0 +1,71 @@
/*
* Carla Engine
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CARLA_ENGINE_THREAD_HPP
#define CARLA_ENGINE_THREAD_HPP

#include "carla_backend_utils.hpp"

class CarlaEngine;
class CarlaPlugin;

#include <QtCore/QMutex>
#include <QtCore/QThread>

CARLA_BACKEND_START_NAMESPACE

class CarlaEngineThread : public QThread
{
public:
CarlaEngineThread(CarlaBackend::CarlaEngine* const engine, QObject* const parent = nullptr);
~CarlaEngineThread();

void startNow();
void stopNow();

protected:
void run();

private:
CarlaBackend::CarlaEngine* const engine;
QMutex mutex;
bool m_stopNow;

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

class ScopedLocker
{
public:
ScopedLocker(CarlaEngineThread* const thread)
: m_thread(thread)
{
m_thread->mutex.lock();
}

~ScopedLocker()
{
m_thread->mutex.unlock();
}

private:
CarlaEngineThread* const m_thread;
};
};

CARLA_BACKEND_END_NAMESPACE

#endif // CARLA_ENGINE_THREAD_HPP

+ 0
- 61
c++/carla-engine/carla_shared.hpp View File

@@ -1,61 +0,0 @@
/*
* Carla Backend
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CARLA_SHARED_H
#define CARLA_SHARED_H

#include "carla_backend.hpp"

CARLA_BACKEND_START_NAMESPACE

/*!
* @defgroup CarlaBackendShared Carla Backend Shared Code
*
* @{
*/

const char* BinaryType2str(const BinaryType type);
const char* PluginType2str(const PluginType type);
const char* PluginCategory2str(const PluginCategory category);
const char* ParameterType2str(const ParameterType type);
const char* InternalParametersIndex2str(const InternalParametersIndex index);
const char* CustomDataType2str(const CustomDataType type);
const char* GuiType2str(const GuiType type);
const char* OptionsType2str(const OptionsType type);
const char* CallbackType2str(const CallbackType type);
const char* ProcessModeType2str(const ProcessModeType type);

CustomDataType getCustomDataStringType(const char* const stype);
const char* getCustomDataTypeString(const CustomDataType type);
const char* getBinaryBidgePath(const BinaryType type);
const char* getPluginTypeString(const PluginType type);

void* getPointer(const uintptr_t addr);
PluginCategory getPluginCategoryFromName(const char* const name);

const char* getLastError();
void setLastError(const char* const error);

#ifndef BUILD_BRIDGE
uint32_t getPluginHintsFromNative(const uint32_t nativeHints);
#endif

/**@}*/

CARLA_BACKEND_END_NAMESPACE

#endif // CARLA_SHARED_H

+ 0
- 111
c++/carla-engine/carla_threads.hpp View File

@@ -1,111 +0,0 @@
/*
* Carla Backend
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CARLA_THREADS_H
#define CARLA_THREADS_H

#include "carla_backend.hpp"

#include <QtCore/QMutex>
#include <QtCore/QThread>

CARLA_BACKEND_START_NAMESPACE
class CarlaEngine;
class CarlaPlugin;
CARLA_BACKEND_END_NAMESPACE

// --------------------------------------------------------------------------------------------------------
// CarlaCheckThread

class CarlaCheckThread : public QThread
{
public:
CarlaCheckThread(CarlaBackend::CarlaEngine* const engine, QObject* const parent = nullptr);
~CarlaCheckThread();

void startNow();
void stopNow();

protected:
void run();

private:
CarlaBackend::CarlaEngine* const engine;
QMutex mutex;
bool m_stopNow;

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

class ScopedLocker
{
public:
ScopedLocker(CarlaCheckThread* const thread)
: m_thread(thread)
{
m_thread->mutex.lock();
}

~ScopedLocker()
{
m_thread->mutex.unlock();
}

private:
CarlaCheckThread* const m_thread;
};
};

// --------------------------------------------------------------------------------------------------------
// CarlaPluginThread

#ifndef BUILD_BRIDGE

class QProcess;

class CarlaPluginThread : public QThread
{
public:
enum PluginThreadMode {
PLUGIN_THREAD_DSSI_GUI,
PLUGIN_THREAD_LV2_GUI,
PLUGIN_THREAD_VST_GUI,
PLUGIN_THREAD_BRIDGE
};

CarlaPluginThread(CarlaBackend::CarlaEngine* const engine, CarlaBackend::CarlaPlugin* const plugin, const PluginThreadMode mode, QObject* const parent = nullptr);
~CarlaPluginThread();

void setOscData(const char* const binary, const char* const label, const char* const data1="");

protected:
void run();

private:
CarlaBackend::CarlaEngine* const engine;
CarlaBackend::CarlaPlugin* const plugin;
const PluginThreadMode mode;

QString m_binary;
QString m_label;
QString m_data1;

QProcess* m_process;
};

#endif

#endif // CARLA_THREADS_H

+ 10
- 8
c++/carla-plugin/Makefile View File

@@ -44,14 +44,16 @@ BUILD_CXX_FLAGS += $(shell pkg-config --cflags linuxsampler) -DWANT_LINUXSAMPLER
endif

OBJS = \
carla_bridge.o \
native.o \
ladspa.o \
dssi.o \
lv2.o \
vst.o \
fluidsynth.o \
linuxsampler.o
carla_plugin.o \
carla_plugin_thread.o \
carla_bridge.o \
native.o \
ladspa.o \
dssi.o \
lv2.o \
vst.o \
fluidsynth.o \
linuxsampler.o

# --------------------------------------------------------------



+ 26
- 5
c++/carla-plugin/carla_bridge.cpp View File

@@ -56,6 +56,27 @@ struct BridgeParamInfo {
: value(0.0) {}
};

const char* getBinaryBidgePath(const BinaryType type)
{
qDebug("CarlaBackend::getBinaryBidgePath(%s)", BinaryType2Str(type));

switch (type)
{
#ifndef BUILD_BRIDGE
// case BINARY_POSIX32:
// return CarlaEngine::options.bridge_posix32;
// case BINARY_POSIX64:
// return CarlaEngine::options.bridge_posix64;
// case BINARY_WIN32:
// return CarlaEngine::options.bridge_win32;
// case BINARY_WIN64:
// return CarlaEngine::options.bridge_win64;
#endif
default:
return nullptr;
}
}

class BridgePlugin : public CarlaPlugin
{
public:
@@ -730,7 +751,7 @@ public:
m_initiated = true;
m_initError = true;

setLastError(error);
x_engine->setLastError(error);

break;
}
@@ -929,7 +950,7 @@ public:

if (! bridgeBinary)
{
setLastError("Bridge not possible, bridge-binary not found");
x_engine->setLastError("Bridge not possible, bridge-binary not found");
return false;
}

@@ -957,7 +978,7 @@ public:
x_engine->__bridgePluginRegister(m_id, nullptr);

osc.thread->terminate();
setLastError("Timeout while waiting for a response from plugin-bridge\n(or the plugin crashed on initialization?)");
x_engine->setLastError("Timeout while waiting for a response from plugin-bridge\n(or the plugin crashed on initialization?)");
return false;
}
else if (m_initError)
@@ -997,13 +1018,13 @@ private:

CarlaPlugin* CarlaPlugin::newBridge(const initializer& init, BinaryType btype, PluginType ptype)
{
qDebug("CarlaPlugin::newBridge(%p, \"%s\", \"%s\", \"%s\", %s, %s)", init.engine, init.filename, init.name, init.label, BinaryType2str(btype), PluginType2str(ptype));
qDebug("CarlaPlugin::newBridge(%p, \"%s\", \"%s\", \"%s\", %s, %s)", init.engine, init.filename, init.name, init.label, BinaryType2Str(btype), PluginType2Str(ptype));

short id = init.engine->getNewPluginId();

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}



+ 1543
- 0
c++/carla-plugin/carla_plugin.cpp
File diff suppressed because it is too large
View File


+ 97
- 1383
c++/carla-plugin/carla_plugin.hpp
File diff suppressed because it is too large
View File


+ 12
- 9
c++/carla-plugin/carla_plugin.pro View File

@@ -21,17 +21,20 @@ TEMPLATE = lib
VERSION = 0.5.0

SOURCES = \
carla_bridge.cpp \
native.cpp \
ladspa.cpp \
dssi.cpp \
lv2.cpp \
vst.cpp \
fluidsynth.cpp \
linuxsampler.cpp
carla_plugin.cpp \
carla_plugin_thread.cpp \
carla_bridge.cpp \
native.cpp \
ladspa.cpp \
dssi.cpp \
lv2.cpp \
vst.cpp \
fluidsynth.cpp \
linuxsampler.cpp

HEADERS = \
carla_plugin.hpp
carla_plugin.hpp \
carla_plugin_thread.hpp

INCLUDEPATH = . \
../carla-backend \


c++/carla-engine/carla_threads.cpp → c++/carla-plugin/carla_plugin_thread.cpp View File

@@ -1,6 +1,6 @@
/*
* Carla Backend
* Copyright (C) 2011-2012 Filipe Coelho <falktx@falktx.com>
* Carla Plugin
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -15,156 +15,12 @@
* For a full copy of the GNU General Public License see the COPYING file
*/

#include "carla_threads.hpp"
#include "carla_engine.hpp"
#include "carla_plugin.hpp"

#include <QtCore/QDebug>
#include <QtCore/QProcess>

// -----------------------------------------------------------------------
// CarlaCheckThread

CarlaCheckThread::CarlaCheckThread(CarlaBackend::CarlaEngine* const engine_, QObject* const parent)
: QThread(parent),
engine(engine_)
{
qDebug("CarlaCheckThread::CarlaCheckThread(%p, %p)", engine, parent);
CARLA_ASSERT(engine);
}

CarlaCheckThread::~CarlaCheckThread()
{
qDebug("CarlaCheckThread::~CarlaCheckThread()");
}

void CarlaCheckThread::startNow()
{
qDebug("CarlaCheckThread::startNow()");
start(QThread::HighPriority);
}

void CarlaCheckThread::stopNow()
{
if (m_stopNow)
return;

m_stopNow = true;

// TESTING - let processing finish first
QMutexLocker(&this->mutex); // FIXME

if (isRunning() && ! wait(200))
{
quit();

if (isRunning() && ! wait(300))
terminate();
}
}

void CarlaCheckThread::run()
{
qDebug("CarlaCheckThread::run()");

using namespace CarlaBackend;

bool oscControlRegisted, usesSingleThread;
unsigned short id, maxPluginNumber = CarlaEngine::maxPluginNumber();
double value;

m_stopNow = false;

while (engine->isRunning() && ! m_stopNow)
{
const ScopedLocker m(this);
oscControlRegisted = engine->isOscControlRegisted();

#ifndef BUILD_BRIDGE
if (engine->getType() != CarlaEngineTypePlugin)
engine->oscWaitEvents();
#endif

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

if (plugin && plugin->enabled())
{
id = plugin->id();
usesSingleThread = (plugin->hints() & PLUGIN_USES_SINGLE_THREAD);

// -------------------------------------------------------
// Process postponed events

if (! usesSingleThread)
plugin->postEventsRun();

// -------------------------------------------------------
// Update parameter outputs

if (oscControlRegisted || ! usesSingleThread)
{
for (uint32_t i=0; i < plugin->parameterCount(); i++)
{
if (plugin->parameterIsOutput(i))
{
value = plugin->getParameterValue(i);

// Update UI
if (! usesSingleThread)
plugin->uiParameterChange(i, value);

// Update OSC control client
if (oscControlRegisted)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_parameter_value(i, value);
#else
engine->osc_send_control_set_parameter_value(id, i, value);
#endif
}
}
}
}

// -------------------------------------------------------
// Update OSC control client

if (oscControlRegisted)
{
// Peak values
if (plugin->audioInCount() > 0)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_inpeak(1, engine->getInputPeak(id, 0));
engine->osc_send_bridge_set_inpeak(2, engine->getInputPeak(id, 1));
#else
engine->osc_send_control_set_input_peak_value(id, 1, engine->getInputPeak(id, 0));
engine->osc_send_control_set_input_peak_value(id, 2, engine->getInputPeak(id, 1));
#endif
}
if (plugin->audioOutCount() > 0)
{
#ifdef BUILD_BRIDGE
engine->osc_send_bridge_set_outpeak(1, engine->getOutputPeak(id, 0));
engine->osc_send_bridge_set_outpeak(2, engine->getOutputPeak(id, 1));
#else
engine->osc_send_control_set_output_peak_value(id, 1, engine->getOutputPeak(id, 0));
engine->osc_send_control_set_output_peak_value(id, 2, engine->getOutputPeak(id, 1));
#endif
}
}
}
}

msleep(50);
}
}

// -----------------------------------------------------------------------
// CarlaPluginThread

#ifndef BUILD_BRIDGE
CARLA_BACKEND_START_NAMESPACE

const char* PluginThreadMode2str(const CarlaPluginThread::PluginThreadMode mode)
{
@@ -294,7 +150,7 @@ void CarlaPluginThread::run()
QString errorString = QString("Plugin '%1' has crashed!\n"
"Saving now will lose its current settings.\n"
"Please remove this plugin, and not rely on it from this point.").arg(plugin->name());
CarlaBackend::setLastError(errorString.toUtf8().constData());
//CarlaBackend::setLastError(errorString.toUtf8().constData());

engine->callback(CarlaBackend::CALLBACK_ERROR, plugin->id(), 0, 0, 0.0);
}
@@ -303,4 +159,4 @@ void CarlaPluginThread::run()
}
}

#endif
CARLA_BACKEND_END_NAMESPACE

+ 61
- 0
c++/carla-plugin/carla_plugin_thread.hpp View File

@@ -0,0 +1,61 @@
/*
* Carla Plugin
* Copyright (C) 2012 Filipe Coelho <falktx@falktx.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* For a full copy of the GNU General Public License see the COPYING file
*/

#ifndef CARLA_PLUGIN_THREAD_HPP
#define CARLA_PLUGIN_THREAD_HPP

#include "carla_backend_utils.hpp"

#include <QtCore/QThread>

class QProcess;

CARLA_BACKEND_START_NAMESPACE

class CarlaPluginThread : public QThread
{
public:
enum PluginThreadMode {
PLUGIN_THREAD_DSSI_GUI,
PLUGIN_THREAD_LV2_GUI,
PLUGIN_THREAD_VST_GUI,
PLUGIN_THREAD_BRIDGE
};

CarlaPluginThread(CarlaEngine* const engine, CarlaPlugin* const plugin, const PluginThreadMode mode, QObject* const parent = nullptr);
~CarlaPluginThread();

void setOscData(const char* const binary, const char* const label, const char* const data1="");

protected:
void run();

private:
CarlaEngine* const engine;
CarlaPlugin* const plugin;
const PluginThreadMode mode;

QString m_binary;
QString m_label;
QString m_data1;

QProcess* m_process;
};

CARLA_BACKEND_END_NAMESPACE

#endif // CARLA_PLUGIN_THREAD_HPP

+ 10
- 10
c++/carla-plugin/dssi.cpp View File

@@ -221,13 +221,13 @@ public:
CARLA_ASSERT(value);

if (type != CUSTOM_DATA_STRING)
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is not string", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is not string", CustomDataType2Str(type), key, value, bool2str(sendGui));

if (! key)
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2Str(type), key, value, bool2str(sendGui));

if (! value)
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("DssiPlugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2Str(type), key, value, bool2str(sendGui));

descriptor->configure(handle, key, value);
if (h2) descriptor->configure(h2, key, value);
@@ -1512,7 +1512,7 @@ public:

if (! libOpen(filename))
{
setLastError(libError(filename));
x_engine->setLastError(libError(filename));
return false;
}

@@ -1523,7 +1523,7 @@ public:

if (! descFn)
{
setLastError("Could not find the DSSI Descriptor in the plugin library");
x_engine->setLastError("Could not find the DSSI Descriptor in the plugin library");
return false;
}

@@ -1540,7 +1540,7 @@ public:

if (! descriptor)
{
setLastError("Could not find the requested plugin Label in the plugin library");
x_engine->setLastError("Could not find the requested plugin Label in the plugin library");
return false;
}

@@ -1561,7 +1561,7 @@ public:

if (! x_client->isOk())
{
setLastError("Failed to register plugin client");
x_engine->setLastError("Failed to register plugin client");
return false;
}

@@ -1572,7 +1572,7 @@ public:

if (! handle)
{
setLastError("Plugin failed to initialize");
x_engine->setLastError("Plugin failed to initialize");
return false;
}

@@ -1622,7 +1622,7 @@ CarlaPlugin* CarlaPlugin::newDSSI(const initializer& init, const void* const ext

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}

@@ -1641,7 +1641,7 @@ CarlaPlugin* CarlaPlugin::newDSSI(const initializer& init, const void* const ext
{
if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{
setLastError("Carla's rack mode can only work with Mono or Stereo DSSI plugins, sorry!");
init.engine->setLastError("Carla's rack mode can only work with Mono or Stereo DSSI plugins, sorry!");
delete plugin;
return nullptr;
}


+ 4
- 4
c++/carla-plugin/fluidsynth.cpp View File

@@ -1247,7 +1247,7 @@ public:

if (f_id < 0)
{
setLastError("Failed to load SoundFont file");
x_engine->setLastError("Failed to load SoundFont file");
return false;
}

@@ -1269,7 +1269,7 @@ public:

if (! x_client->isOk())
{
setLastError("Failed to register plugin client");
x_engine->setLastError("Failed to register plugin client");
return false;
}

@@ -1323,13 +1323,13 @@ CarlaPlugin* CarlaPlugin::newSF2(const initializer& init)

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}

if (! fluid_is_soundfont(init.filename))
{
setLastError("Requested file is not a valid SoundFont");
init.engine->setLastError("Requested file is not a valid SoundFont");
return nullptr;
}



+ 7
- 7
c++/carla-plugin/ladspa.cpp View File

@@ -1128,7 +1128,7 @@ public:

if (! libOpen(filename))
{
setLastError(libError(filename));
x_engine->setLastError(libError(filename));
return false;
}

@@ -1139,7 +1139,7 @@ public:

if (! descFn)
{
setLastError("Could not find the LASDPA Descriptor in the plugin library");
x_engine->setLastError("Could not find the LASDPA Descriptor in the plugin library");
return false;
}

@@ -1155,7 +1155,7 @@ public:

if (! descriptor)
{
setLastError("Could not find the requested plugin Label in the plugin library");
x_engine->setLastError("Could not find the requested plugin Label in the plugin library");
return false;
}

@@ -1181,7 +1181,7 @@ public:

if (! x_client->isOk())
{
setLastError("Failed to register plugin client");
x_engine->setLastError("Failed to register plugin client");
return false;
}

@@ -1192,7 +1192,7 @@ public:

if (! handle)
{
setLastError("Plugin failed to initialize");
x_engine->setLastError("Plugin failed to initialize");
return false;
}

@@ -1226,7 +1226,7 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const initializer& init, const void* const e

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}

@@ -1245,7 +1245,7 @@ CarlaPlugin* CarlaPlugin::newLADSPA(const initializer& init, const void* const e
{
if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{
setLastError("Carla's rack mode can only work with Mono or Stereo LADSPA plugins, sorry!");
init.engine->setLastError("Carla's rack mode can only work with Mono or Stereo LADSPA plugins, sorry!");
delete plugin;
return nullptr;
}


+ 7
- 7
c++/carla-plugin/linuxsampler.cpp View File

@@ -827,7 +827,7 @@ public:
}
catch (LinuxSampler::Exception& e)
{
setLastError(e.what());
x_engine->setLastError(e.what());
return false;
}

@@ -836,7 +836,7 @@ public:
}
catch (LinuxSampler::Exception& e)
{
setLastError(e.what());
x_engine->setLastError(e.what());
return false;
}

@@ -845,7 +845,7 @@ public:
}
catch (LinuxSampler::Exception& e)
{
setLastError(e.what());
x_engine->setLastError(e.what());
return false;
}

@@ -880,13 +880,13 @@ public:
if (x_client->isOk())
return true;
else
setLastError("Failed to register plugin client");
x_engine->setLastError("Failed to register plugin client");
}
else
setLastError("Failed to find any instruments");
x_engine->setLastError("Failed to find any instruments");
}
else
setLastError("Requested file is not valid or does not exist");
x_engine->setLastError("Requested file is not valid or does not exist");

return false;
}
@@ -920,7 +920,7 @@ CarlaPlugin* LinuxSamplerPlugin::newLinuxSampler(const initializer& init, bool i

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}



+ 18
- 16
c++/carla-plugin/lv2.cpp View File

@@ -19,6 +19,7 @@

#ifdef WANT_LV2

#include "carla_lib_utils.hpp"
#include "carla_lv2_utils.hpp"

#include "lv2_atom_queue.hpp"
@@ -27,6 +28,7 @@
#include <set>

#include <QtCore/QDir>
#include <QtGui/QDialog>
#include <QtGui/QLayout>

#ifdef HAVE_SUIL
@@ -853,13 +855,13 @@ public:
CARLA_ASSERT(value);

if (type == CUSTOM_DATA_INVALID)
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is invalid", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is invalid", CustomDataType2Str(type), key, value, bool2str(sendGui));

if (! key)
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2Str(type), key, value, bool2str(sendGui));

if (! value)
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("Lv2Plugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2Str(type), key, value, bool2str(sendGui));

CarlaPlugin::setCustomData(type, key, value, sendGui);

@@ -3199,7 +3201,7 @@ public:

if (dtype == CUSTOM_DATA_INVALID)
{
qCritical("Lv2Plugin::handleStateStore(%i, %p, " P_SIZE ", %i, %i) - invalid type '%s'", key, value, size, type, flags, CustomDataType2str(dtype));
qCritical("Lv2Plugin::handleStateStore(%i, %p, " P_SIZE ", %i, %i) - invalid type '%s'", key, value, size, type, flags, CustomDataType2Str(dtype));
return LV2_STATE_ERR_BAD_TYPE;
}

@@ -3291,7 +3293,7 @@ public:
return chunk.constData();
}

qCritical("Lv2Plugin::handleStateRetrieve(%i, %p, %p, %p) - invalid key type '%s'", key, size, type, flags, CustomDataType2str(dtype));
qCritical("Lv2Plugin::handleStateRetrieve(%i, %p, %p, %p) - invalid key type '%s'", key, size, type, flags, CustomDataType2Str(dtype));
return nullptr;
}

@@ -3937,7 +3939,7 @@ public:

if (! rdf_descriptor)
{
setLastError("Failed to find the requested plugin in the LV2 Bundle");
x_engine->setLastError("Failed to find the requested plugin in the LV2 Bundle");
return false;
}

@@ -3946,7 +3948,7 @@ public:

if (! libOpen(rdf_descriptor->Binary))
{
setLastError(libError(rdf_descriptor->Binary));
x_engine->setLastError(libError(rdf_descriptor->Binary));
return false;
}

@@ -4061,7 +4063,7 @@ public:

if (! libDesc)
{
setLastError("Plugin failed to return library descriptor");
x_engine->setLastError("Plugin failed to return library descriptor");
return false;
}

@@ -4092,7 +4094,7 @@ public:

if (! descFn)
{
setLastError("Could not find the LV2 Descriptor in the plugin library");
x_engine->setLastError("Could not find the LV2 Descriptor in the plugin library");
return false;
}

@@ -4109,7 +4111,7 @@ public:

if (! descriptor)
{
setLastError("Could not find the requested plugin URI in the plugin library");
x_engine->setLastError("Could not find the requested plugin URI in the plugin library");
return false;
}

@@ -4126,7 +4128,7 @@ public:
{
if (! LV2_IS_PORT_OPTIONAL(rdf_descriptor->Ports[i].Properties))
{
setLastError("Plugin requires a port that is not currently supported");
x_engine->setLastError("Plugin requires a port that is not currently supported");
canContinue = false;
break;
}
@@ -4139,7 +4141,7 @@ public:
if (LV2_IS_FEATURE_REQUIRED(rdf_descriptor->Features[i].Type) && ! is_lv2_feature_supported(rdf_descriptor->Features[i].URI))
{
QString msg = QString("Plugin requires a feature that is not supported:\n%1").arg(rdf_descriptor->Features[i].URI);
setLastError(msg.toUtf8().constData());
x_engine->setLastError(msg.toUtf8().constData());
canContinue = false;
break;
}
@@ -4185,7 +4187,7 @@ public:

if (! x_client->isOk())
{
setLastError("Failed to register plugin client");
x_engine->setLastError("Failed to register plugin client");
return false;
}

@@ -4196,7 +4198,7 @@ public:

if (! handle)
{
setLastError("Plugin failed to initialize");
x_engine->setLastError("Plugin failed to initialize");
return false;
}

@@ -4673,7 +4675,7 @@ CarlaPlugin* CarlaPlugin::newLV2(const initializer& init)

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}

@@ -4692,7 +4694,7 @@ CarlaPlugin* CarlaPlugin::newLV2(const initializer& init)
{
if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{
setLastError("Carla's rack mode can only work with Mono (simple) or Stereo LV2 plugins, sorry!");
init.engine->setLastError("Carla's rack mode can only work with Mono (simple) or Stereo LV2 plugins, sorry!");
delete plugin;
return nullptr;
}


+ 8
- 8
c++/carla-plugin/native.cpp View File

@@ -365,13 +365,13 @@ public:
CARLA_ASSERT(value);

if (type != CUSTOM_DATA_STRING)
return qCritical("NativePlugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is not string", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("NativePlugin::setCustomData(%s, \"%s\", \"%s\", %s) - type is not string", CustomDataType2Str(type), key, value, bool2str(sendGui));

if (! key)
return qCritical("NativePlugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("NativePlugin::setCustomData(%s, \"%s\", \"%s\", %s) - key is null", CustomDataType2Str(type), key, value, bool2str(sendGui));

if (! value)
return qCritical("Nativelugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2str(type), key, value, bool2str(sendGui));
return qCritical("Nativelugin::setCustomData(%s, \"%s\", \"%s\", %s) - value is null", CustomDataType2Str(type), key, value, bool2str(sendGui));

if (descriptor)
{
@@ -1602,7 +1602,7 @@ public:

if (! descriptor)
{
setLastError("Invalid internal plugin");
x_engine->setLastError("Invalid internal plugin");
return false;
}

@@ -1613,7 +1613,7 @@ public:

if (! handle)
{
setLastError("Plugin failed to initialize");
x_engine->setLastError("Plugin failed to initialize");
return false;
}

@@ -1632,7 +1632,7 @@ public:

if (! x_client->isOk())
{
setLastError("Failed to register plugin client");
x_engine->setLastError("Failed to register plugin client");
return false;
}

@@ -1665,7 +1665,7 @@ CarlaPlugin* CarlaPlugin::newNative(const initializer& init)

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}

@@ -1683,7 +1683,7 @@ CarlaPlugin* CarlaPlugin::newNative(const initializer& init)
{
if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{
setLastError("Carla's rack mode can only work with Mono or Stereo Internal plugins, sorry!");
init.engine->setLastError("Carla's rack mode can only work with Mono or Stereo Internal plugins, sorry!");
delete plugin;
return nullptr;
}


+ 6
- 6
c++/carla-plugin/vst.cpp View File

@@ -2200,7 +2200,7 @@ public:

if (! libOpen(filename))
{
setLastError(libError(filename));
x_engine->setLastError(libError(filename));
return false;
}

@@ -2215,7 +2215,7 @@ public:

if (! vstFn)
{
setLastError("Could not find the VST main entry in the plugin library");
x_engine->setLastError("Could not find the VST main entry in the plugin library");
return false;
}
}
@@ -2229,7 +2229,7 @@ public:

if ((! effect) || effect->magic != kEffectMagic)
{
setLastError("Plugin failed to initialize");
x_engine->setLastError("Plugin failed to initialize");
return false;
}

@@ -2269,7 +2269,7 @@ public:

if (! x_client->isOk())
{
setLastError("Failed to register plugin client");
x_engine->setLastError("Failed to register plugin client");
return false;
}

@@ -2387,7 +2387,7 @@ CarlaPlugin* CarlaPlugin::newVST(const initializer& init)

if (id < 0 || id > CarlaEngine::maxPluginNumber())
{
setLastError("Maximum number of plugins reached");
init.engine->setLastError("Maximum number of plugins reached");
return nullptr;
}

@@ -2406,7 +2406,7 @@ CarlaPlugin* CarlaPlugin::newVST(const initializer& init)
{
if (! (plugin->hints() & PLUGIN_CAN_FORCE_STEREO))
{
setLastError("Carla's rack mode can only work with Stereo VST plugins, sorry!");
init.engine->setLastError("Carla's rack mode can only work with Stereo VST plugins, sorry!");
delete plugin;
return nullptr;
}


Loading…
Cancel
Save