Browse Source

Add a few more assertions and checks

tags/1.9.4
falkTX 11 years ago
parent
commit
86d04cc397
12 changed files with 398 additions and 20 deletions
  1. +1
    -0
      source/Makefile.mk
  2. +4
    -0
      source/backend/engine/CarlaEngine.cpp
  3. +20
    -0
      source/backend/plugin/BridgePlugin.cpp
  4. +47
    -4
      source/backend/plugin/CarlaPlugin.cpp
  5. +56
    -1
      source/backend/plugin/DssiPlugin.cpp
  6. +46
    -0
      source/backend/plugin/FluidSynthPlugin.cpp
  7. +51
    -0
      source/backend/plugin/LadspaPlugin.cpp
  8. +40
    -0
      source/backend/plugin/LinuxSamplerPlugin.cpp
  9. +20
    -0
      source/backend/plugin/Lv2Plugin.cpp
  10. +53
    -4
      source/backend/plugin/NativePlugin.cpp
  11. +52
    -3
      source/backend/plugin/VstPlugin.cpp
  12. +8
    -8
      source/bridges/Makefile

+ 1
- 0
source/Makefile.mk View File

@@ -54,6 +54,7 @@ BUILD_CXX_FLAGS += -DVESTIGE_HEADER


HAVE_JACK = $(shell pkg-config --exists jack && echo true) HAVE_JACK = $(shell pkg-config --exists jack && echo true)
HAVE_OPENGL = $(shell pkg-config --exists gl && echo true) HAVE_OPENGL = $(shell pkg-config --exists gl && echo true)
HAVE_QT5 = $(shell pkg-config --atleast-version=5.0 QtCore && echo true)


HAVE_AF_DEPS = $(shell pkg-config --exists libavcodec libavformat sndfile && echo true) HAVE_AF_DEPS = $(shell pkg-config --exists libavcodec libavformat sndfile && echo true)
HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true) HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)


+ 4
- 0
source/backend/engine/CarlaEngine.cpp View File

@@ -1033,6 +1033,10 @@ bool CarlaEngine::loadProject(const char* const filename)
if (node.toElement().tagName() == "Plugin") if (node.toElement().tagName() == "Plugin")
{ {
const SaveState& saveState = getSaveStateDictFromXML(node); const SaveState& saveState = getSaveStateDictFromXML(node);
CARLA_ASSERT(saveState.type != nullptr);

if (saveState.type == nullptr)
continue;


const void* extraStuff = nullptr; const void* extraStuff = nullptr;




+ 20
- 0
source/backend/plugin/BridgePlugin.cpp View File

@@ -914,6 +914,26 @@ public:


bool init(const char* const filename, const char* const name, const char* const label, const char* const bridgeBinary) bool init(const char* const filename, const char* const name, const char* const label, const char* const bridgeBinary)
{ {
// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (filename == nullptr)
{
kData->engine->setLastError("null filename");
return false;
}

m_filename = strdup(filename); m_filename = strdup(filename);


if (name) if (name)


+ 47
- 4
source/backend/plugin/CarlaPlugin.cpp View File

@@ -655,7 +655,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)


QVector<ParamSymbol> paramSymbols; QVector<ParamSymbol> paramSymbols;


if (std::strcmp(saveState.type, "LADSPA") == 0 || std::strcmp(saveState.type, "LV2") == 0)
if (type() == PLUGIN_LADSPA || type() == PLUGIN_LV2)
{ {
for (uint32_t i=0; i < kData->param.count; i++) for (uint32_t i=0; i < kData->param.count; i++)
{ {
@@ -680,7 +680,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)


int32_t index = -1; int32_t index = -1;


if (std::strcmp(saveState.type, "LADSPA") == 0)
if (type() == PLUGIN_LADSPA)
{ {
// Try to set by symbol, otherwise use index // Try to set by symbol, otherwise use index
if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0)
@@ -699,7 +699,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState)
else else
index = stateParameter->index; index = stateParameter->index;
} }
else if (std::strcmp(saveState.type, "LV2") == 0)
else if (type() == PLUGIN_LV2)
{ {
// Symbol only // Symbol only
if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0)
@@ -1178,6 +1178,13 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c
CARLA_ASSERT(cData.key != nullptr); CARLA_ASSERT(cData.key != nullptr);
CARLA_ASSERT(cData.value != nullptr); CARLA_ASSERT(cData.value != nullptr);


if (cData.type == nullptr)
return;
if (cData.key == nullptr)
return;
if (cData.value == nullptr)
return;

if (std::strcmp(cData.key, key) == 0) if (std::strcmp(cData.key, key) == 0)
{ {
if (cData.value != nullptr) if (cData.value != nullptr)
@@ -1926,6 +1933,15 @@ CarlaPlugin::ScopedDisabler::ScopedDisabler(CarlaPlugin* const plugin)
{ {
carla_debug("CarlaPlugin::ScopedDisabler(%p)", plugin); carla_debug("CarlaPlugin::ScopedDisabler(%p)", plugin);
CARLA_ASSERT(plugin != nullptr); CARLA_ASSERT(plugin != nullptr);
CARLA_ASSERT(plugin->kData != nullptr);
CARLA_ASSERT(plugin->kData->client != nullptr);

if (plugin == nullptr)
return;
if (plugin->kData == nullptr)
return;
if (plugin->kData->client == nullptr)
return;


plugin->kData->masterMutex.lock(); plugin->kData->masterMutex.lock();


@@ -1939,6 +1955,16 @@ CarlaPlugin::ScopedDisabler::ScopedDisabler(CarlaPlugin* const plugin)
CarlaPlugin::ScopedDisabler::~ScopedDisabler() CarlaPlugin::ScopedDisabler::~ScopedDisabler()
{ {
carla_debug("CarlaPlugin::~ScopedDisabler()"); carla_debug("CarlaPlugin::~ScopedDisabler()");
CARLA_ASSERT(kPlugin != nullptr);
CARLA_ASSERT(kPlugin->kData != nullptr);
CARLA_ASSERT(kPlugin->kData->client != nullptr);

if (kPlugin == nullptr)
return;
if (kPlugin->kData == nullptr)
return;
if (kPlugin->kData->client == nullptr)
return;


kPlugin->fEnabled = true; kPlugin->fEnabled = true;
kPlugin->kData->client->activate(); kPlugin->kData->client->activate();
@@ -1955,13 +1981,19 @@ CarlaPlugin::ScopedProcessLocker::ScopedProcessLocker(CarlaPlugin* const plugin,
carla_debug("CarlaPlugin::ScopedProcessLocker(%p, %s)", plugin, bool2str(block)); carla_debug("CarlaPlugin::ScopedProcessLocker(%p, %s)", plugin, bool2str(block));
CARLA_ASSERT(plugin != nullptr); CARLA_ASSERT(plugin != nullptr);


if (block)
if (plugin != nullptr && block)
plugin->kData->singleMutex.lock(); plugin->kData->singleMutex.lock();
} }


CarlaPlugin::ScopedProcessLocker::~ScopedProcessLocker() CarlaPlugin::ScopedProcessLocker::~ScopedProcessLocker()
{ {
carla_debug("CarlaPlugin::~ScopedProcessLocker()"); carla_debug("CarlaPlugin::~ScopedProcessLocker()");
CARLA_ASSERT(kPlugin != nullptr && kPlugin->kData != nullptr);

if (kPlugin == nullptr)
return;
if (kPlugin->kData == nullptr)
return;


if (kBlock) if (kBlock)
{ {
@@ -2005,6 +2037,14 @@ void CarlaPluginGUI::idle()


void CarlaPluginGUI::resizeLater(int width, int height) void CarlaPluginGUI::resizeLater(int width, int height)
{ {
CARLA_ASSERT_INT(width > 0, width);
CARLA_ASSERT_INT(height > 0, height);

if (width <= 0)
return;
if (height <= 0)
return;

fNextWidth = width; fNextWidth = width;
fNextHeight = height; fNextHeight = height;
} }
@@ -2047,6 +2087,9 @@ void CarlaPluginGUI::closeEvent(QCloseEvent* const event)
carla_debug("CarlaPluginGUI::closeEvent(%p)", event); carla_debug("CarlaPluginGUI::closeEvent(%p)", event);
CARLA_ASSERT(event != nullptr); CARLA_ASSERT(event != nullptr);


if (event == nullptr)
return;

if (! event->spontaneous()) if (! event->spontaneous())
{ {
event->ignore(); event->ignore();


+ 56
- 1
source/backend/plugin/DssiPlugin.cpp View File

@@ -370,8 +370,18 @@ public:
carla_debug("DssiPlugin::reload() - start"); carla_debug("DssiPlugin::reload() - start");
CARLA_ASSERT(kData->engine != nullptr); CARLA_ASSERT(kData->engine != nullptr);
CARLA_ASSERT(fDescriptor != nullptr); CARLA_ASSERT(fDescriptor != nullptr);
CARLA_ASSERT(fDssiDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr); CARLA_ASSERT(fHandle != nullptr);


if (kData->engine == nullptr)
return;
if (fDescriptor == nullptr)
return;
if (fDssiDescriptor == nullptr)
return;
if (fHandle == nullptr)
return;

const ProcessMode processMode(kData->engine->getProccessMode()); const ProcessMode processMode(kData->engine->getProccessMode());


// Safely disable plugin for reload // Safely disable plugin for reload
@@ -1065,8 +1075,9 @@ public:
{ {
if (processSingle(inBuffer, outBuffer, time - timeOffset, timeOffset, midiEventCount)) if (processSingle(inBuffer, outBuffer, time - timeOffset, timeOffset, midiEventCount))
{ {
midiEventCount = 0;
startTime = 0;
timeOffset = time; timeOffset = time;
midiEventCount = 0;


if (kData->midiprog.current >= 0 && kData->midiprog.count > 0) if (kData->midiprog.current >= 0 && kData->midiprog.count > 0)
nextBankId = kData->midiprog.data[kData->midiprog.current].bank; nextBankId = kData->midiprog.data[kData->midiprog.current].bank;
@@ -1434,6 +1445,24 @@ public:


bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset, const unsigned long midiEventCount) bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset, const unsigned long midiEventCount)
{ {
CARLA_ASSERT(frames > 0);

if (frames == 0)
return false;

if (kData->audioIn.count > 0)
{
CARLA_ASSERT(inBuffer != nullptr);
if (inBuffer == nullptr)
return false;
}
if (kData->audioOut.count > 0)
{
CARLA_ASSERT(outBuffer != nullptr);
if (outBuffer == nullptr)
return false;
}

uint32_t i, k; uint32_t i, k;


// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
@@ -1748,6 +1777,32 @@ public:
CARLA_ASSERT(filename != nullptr); CARLA_ASSERT(filename != nullptr);
CARLA_ASSERT(label != nullptr); CARLA_ASSERT(label != nullptr);


// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (filename == nullptr)
{
kData->engine->setLastError("null filename");
return false;
}

if (label == nullptr)
{
kData->engine->setLastError("null label");
return false;
}

// --------------------------------------------------------------- // ---------------------------------------------------------------
// open DLL // open DLL




+ 46
- 0
source/backend/plugin/FluidSynthPlugin.cpp View File

@@ -392,6 +392,11 @@ public:
CARLA_ASSERT(kData->engine != nullptr); CARLA_ASSERT(kData->engine != nullptr);
CARLA_ASSERT(fSynth != nullptr); CARLA_ASSERT(fSynth != nullptr);


if (kData->engine == nullptr)
return;
if (fSynth == nullptr)
return;

const ProcessMode processMode(kData->engine->getProccessMode()); const ProcessMode processMode(kData->engine->getProccessMode());


// Safely disable plugin for reload // Safely disable plugin for reload
@@ -957,6 +962,7 @@ public:
{ {
if (processSingle(outBuffer, time - timeOffset, timeOffset)) if (processSingle(outBuffer, time - timeOffset, timeOffset))
{ {
startTime = 0;
timeOffset = time; timeOffset = time;


if (kData->midiprog.current >= 0 && kData->midiprog.count > 0 && kData->ctrlChannel >= 0 && kData->ctrlChannel < 16) if (kData->midiprog.current >= 0 && kData->midiprog.count > 0 && kData->ctrlChannel >= 0 && kData->ctrlChannel < 16)
@@ -1233,6 +1239,14 @@ public:


bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset) bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)
{ {
CARLA_ASSERT(outBuffer != nullptr);
CARLA_ASSERT(frames > 0);

if (outBuffer == nullptr)
return false;
if (frames == 0)
return false;

uint32_t i, k; uint32_t i, k;


// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
@@ -1373,6 +1387,38 @@ public:
CARLA_ASSERT(filename != nullptr); CARLA_ASSERT(filename != nullptr);
CARLA_ASSERT(label != nullptr); CARLA_ASSERT(label != nullptr);


// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (fSynth == nullptr)
{
kData->engine->setLastError("null synth");
return false;
}

if (filename == nullptr)
{
kData->engine->setLastError("null filename");
return false;
}

if (label == nullptr)
{
kData->engine->setLastError("null label");
return false;
}

// --------------------------------------------------------------- // ---------------------------------------------------------------
// open soundfont // open soundfont




+ 51
- 0
source/backend/plugin/LadspaPlugin.cpp View File

@@ -368,6 +368,13 @@ public:
CARLA_ASSERT(fDescriptor != nullptr); CARLA_ASSERT(fDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr); CARLA_ASSERT(fHandle != nullptr);


if (kData->engine == nullptr)
return;
if (fDescriptor == nullptr)
return;
if (fHandle == nullptr)
return;

const ProcessMode processMode(kData->engine->getProccessMode()); const ProcessMode processMode(kData->engine->getProccessMode());


// Safely disable plugin for reload // Safely disable plugin for reload
@@ -1078,6 +1085,24 @@ public:


bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset) bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)
{ {
CARLA_ASSERT(frames > 0);

if (frames == 0)
return false;

if (kData->audioIn.count > 0)
{
CARLA_ASSERT(inBuffer != nullptr);
if (inBuffer == nullptr)
return false;
}
if (kData->audioOut.count > 0)
{
CARLA_ASSERT(outBuffer != nullptr);
if (outBuffer == nullptr)
return false;
}

uint32_t i, k; uint32_t i, k;


// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
@@ -1305,6 +1330,32 @@ public:
CARLA_ASSERT(filename != nullptr); CARLA_ASSERT(filename != nullptr);
CARLA_ASSERT(label != nullptr); CARLA_ASSERT(label != nullptr);


// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (filename == nullptr)
{
kData->engine->setLastError("null filename");
return false;
}

if (label == nullptr)
{
kData->engine->setLastError("null label");
return false;
}

// --------------------------------------------------------------- // ---------------------------------------------------------------
// open DLL // open DLL




+ 40
- 0
source/backend/plugin/LinuxSamplerPlugin.cpp View File

@@ -301,6 +301,11 @@ public:
CARLA_ASSERT(kData->engine != nullptr); CARLA_ASSERT(kData->engine != nullptr);
CARLA_ASSERT(fInstrument != nullptr); CARLA_ASSERT(fInstrument != nullptr);


if (kData->engine == nullptr)
return;
if (fInstrument == nullptr)
return;

const ProcessMode processMode(kData->engine->getProccessMode()); const ProcessMode processMode(kData->engine->getProccessMode());


// Safely disable plugin for reload // Safely disable plugin for reload
@@ -544,6 +549,7 @@ public:
{ {
if (processSingle(outBuffer, time - timeOffset, timeOffset)) if (processSingle(outBuffer, time - timeOffset, timeOffset))
{ {
startTime = 0;
timeOffset = time; timeOffset = time;


if (kData->midiprog.current >= 0 && kData->midiprog.count > 0) if (kData->midiprog.current >= 0 && kData->midiprog.count > 0)
@@ -803,6 +809,14 @@ public:


bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset) bool processSingle(float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)
{ {
CARLA_ASSERT(outBuffer != nullptr);
CARLA_ASSERT(frames > 0);

if (outBuffer == nullptr)
return false;
if (frames == 0)
return false;

uint32_t i, k; uint32_t i, k;


// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
@@ -893,6 +907,32 @@ public:
CARLA_ASSERT(filename != nullptr); CARLA_ASSERT(filename != nullptr);
CARLA_ASSERT(label != nullptr); CARLA_ASSERT(label != nullptr);


// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (filename == nullptr)
{
kData->engine->setLastError("null filename");
return false;
}

if (label == nullptr)
{
kData->engine->setLastError("null label");
return false;
}

// --------------------------------------------------------------- // ---------------------------------------------------------------
// Check if file exists // Check if file exists
{ {


+ 20
- 0
source/backend/plugin/Lv2Plugin.cpp View File

@@ -3937,6 +3937,26 @@ public:


bool init(const char* const bundle, const char* const name, const char* const URI) bool init(const char* const bundle, const char* const name, const char* const URI)
{ {
// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (filename == nullptr)
{
kData->engine->setLastError("null filename");
return false;
}

// --------------------------------------------------------------- // ---------------------------------------------------------------
// get plugin from lv2_rdf (lilv) // get plugin from lv2_rdf (lilv)




+ 53
- 4
source/backend/plugin/NativePlugin.cpp View File

@@ -266,6 +266,9 @@ public:
{ {
CARLA_ASSERT(fDescriptor != nullptr); CARLA_ASSERT(fDescriptor != nullptr);


if (fDescriptor == nullptr)
return 0x0;

unsigned int options = 0x0; unsigned int options = 0x0;


if (fDescriptor->name != nullptr) if (fDescriptor->name != nullptr)
@@ -619,6 +622,13 @@ public:
CARLA_ASSERT(fDescriptor != nullptr); CARLA_ASSERT(fDescriptor != nullptr);
CARLA_ASSERT(fHandle != nullptr); CARLA_ASSERT(fHandle != nullptr);


if (kData->engine == nullptr)
return;
if (fDescriptor == nullptr)
return;
if (fHandle == nullptr)
return;

const ProcessMode processMode(kData->engine->getProccessMode()); const ProcessMode processMode(kData->engine->getProccessMode());


// Safely disable plugin for reload // Safely disable plugin for reload
@@ -1237,14 +1247,15 @@ public:
{ {
if (processSingle(inBuffer, outBuffer, time - timeOffset, timeOffset)) if (processSingle(inBuffer, outBuffer, time - timeOffset, timeOffset))
{ {
startTime = 0;
timeOffset = time;
nextBankId = 0;

if (fMidiEventCount > 0) if (fMidiEventCount > 0)
{ {
//carla_zeroMem(fMidiEvents, sizeof(::MidiEvent)*fMidiEventCount); //carla_zeroMem(fMidiEvents, sizeof(::MidiEvent)*fMidiEventCount);
fMidiEventCount = 0; fMidiEventCount = 0;
} }

nextBankId = 0;
timeOffset = time;
} }
else else
startTime += timeOffset; startTime += timeOffset;
@@ -1555,6 +1566,24 @@ public:


bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset) bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)
{ {
CARLA_ASSERT(frames > 0);

if (frames == 0)
return false;

if (kData->audioIn.count > 0)
{
CARLA_ASSERT(inBuffer != nullptr);
if (inBuffer == nullptr)
return false;
}
if (kData->audioOut.count > 0)
{
CARLA_ASSERT(outBuffer != nullptr);
if (outBuffer == nullptr)
return false;
}

uint32_t i, k; uint32_t i, k;


// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
@@ -1930,7 +1959,27 @@ public:
{ {
CARLA_ASSERT(kData->engine != nullptr); CARLA_ASSERT(kData->engine != nullptr);
CARLA_ASSERT(kData->client == nullptr); CARLA_ASSERT(kData->client == nullptr);
CARLA_ASSERT(label);
CARLA_ASSERT(label != nullptr);

// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (label == nullptr)
{
kData->engine->setLastError("null label");
return false;
}


// --------------------------------------------------------------- // ---------------------------------------------------------------
// get descriptor that matches label // get descriptor that matches label


+ 52
- 3
source/backend/plugin/VstPlugin.cpp View File

@@ -168,6 +168,9 @@ public:
{ {
CARLA_ASSERT(fEffect != nullptr); CARLA_ASSERT(fEffect != nullptr);


if (fEffect == nullptr)
return 0x0;

unsigned int options = 0x0; unsigned int options = 0x0;


options |= PLUGIN_OPTION_FIXED_BUFFER; options |= PLUGIN_OPTION_FIXED_BUFFER;
@@ -286,7 +289,9 @@ public:
CARLA_ASSERT(parameterId < kData->param.count); CARLA_ASSERT(parameterId < kData->param.count);


const float fixedValue = kData->param.fixValue(parameterId, value); const float fixedValue = kData->param.fixValue(parameterId, value);
fEffect->setParameter(fEffect, parameterId, fixedValue);

if (fEffect != nullptr)
fEffect->setParameter(fEffect, parameterId, fixedValue);


CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback); CarlaPlugin::setParameterValue(parameterId, fixedValue, sendGui, sendOsc, sendCallback);
} }
@@ -431,6 +436,11 @@ public:
CARLA_ASSERT(kData->engine != nullptr); CARLA_ASSERT(kData->engine != nullptr);
CARLA_ASSERT(fEffect != nullptr); CARLA_ASSERT(fEffect != nullptr);


if (kData->engine == nullptr)
return;
if (fEffect == nullptr)
return;

const ProcessMode processMode(kData->engine->getProccessMode()); const ProcessMode processMode(kData->engine->getProccessMode());


// Safely disable plugin for reload // Safely disable plugin for reload
@@ -1085,13 +1095,14 @@ public:
{ {
if (processSingle(inBuffer, outBuffer, time - timeOffset, timeOffset)) if (processSingle(inBuffer, outBuffer, time - timeOffset, timeOffset))
{ {
startTime = 0;
timeOffset = time;

if (fMidiEventCount > 0) if (fMidiEventCount > 0)
{ {
//carla_zeroMem(fMidiEvents, sizeof(::MidiEvent)*fMidiEventCount); //carla_zeroMem(fMidiEvents, sizeof(::MidiEvent)*fMidiEventCount);
fMidiEventCount = 0; fMidiEventCount = 0;
} }

timeOffset = time;
} }
else else
startTime += timeOffset; startTime += timeOffset;
@@ -1367,6 +1378,24 @@ public:


bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset) bool processSingle(float** const inBuffer, float** const outBuffer, const uint32_t frames, const uint32_t timeOffset)
{ {
CARLA_ASSERT(frames > 0);

if (frames == 0)
return false;

if (kData->audioIn.count > 0)
{
CARLA_ASSERT(inBuffer != nullptr);
if (inBuffer == nullptr)
return false;
}
if (kData->audioOut.count > 0)
{
CARLA_ASSERT(outBuffer != nullptr);
if (outBuffer == nullptr)
return false;
}

uint32_t i, k; uint32_t i, k;


// -------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------
@@ -2017,6 +2046,26 @@ public:
CARLA_ASSERT(kData->client == nullptr); CARLA_ASSERT(kData->client == nullptr);
CARLA_ASSERT(filename != nullptr); CARLA_ASSERT(filename != nullptr);


// ---------------------------------------------------------------
// first checks

if (kData->engine == nullptr)
{
return false;
}

if (kData->client != nullptr)
{
kData->engine->setLastError("Plugin client is already registered");
return false;
}

if (filename == nullptr)
{
kData->engine->setLastError("null filename");
return false;
}

// --------------------------------------------------------------- // ---------------------------------------------------------------
// open DLL // open DLL




+ 8
- 8
source/bridges/Makefile View File

@@ -30,16 +30,13 @@ LINK_FLAGS += $(shell pkg-config --libs liblo QtCore)
# Plugin bridges # Plugin bridges


BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS) BUILD_PLUGIN_FLAGS = $(BUILD_CXX_FLAGS)
BUILD_PLUGIN_FLAGS += -DBUILD_BRIDGE_PLUGIN -DBRIDGE_PLUGIN -DWANT_JACK
BUILD_PLUGIN_FLAGS += -DBUILD_BRIDGE_PLUGIN -DBRIDGE_PLUGIN
BUILD_PLUGIN_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST -DWANT_JACK
BUILD_PLUGIN_FLAGS += -I../backend/engine -I../backend/plugin -I../libs BUILD_PLUGIN_FLAGS += -I../backend/engine -I../backend/plugin -I../libs
BUILD_PLUGIN_FLAGS += $(shell pkg-config --cflags QtGui QtXml)
BUILD_PLUGIN_FLAGS += $(QT_UI_FLAGS) $(shell pkg-config --cflags QtXml)


LINK_PLUGIN_FLAGS = $(LINK_FLAGS) LINK_PLUGIN_FLAGS = $(LINK_FLAGS)
LINK_PLUGIN_FLAGS += $(shell pkg-config --libs QtGui QtXml) -lpthread

ifeq ($(CARLA_PLUGIN_SUPPORT),true)
BUILD_PLUGIN_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST
endif
LINK_PLUGIN_FLAGS += $(QT_UI_FLAGS) $(shell pkg-config --libs QtXml) -lpthread


# -------------------------------------------------------------- # --------------------------------------------------------------
# Plugin bridges (POSIX) # Plugin bridges (POSIX)
@@ -65,11 +62,13 @@ NATIVE_LINK_FLAGS = $(POSIX_LINK_FLAGS)


ifeq ($(HAVE_FLUIDSYNTH),true) ifeq ($(HAVE_FLUIDSYNTH),true)
NATIVE_BUILD_FLAGS += -DWANT_FLUIDSYNTH NATIVE_BUILD_FLAGS += -DWANT_FLUIDSYNTH
NATIVE_BUILD_FLAGS += $(shell pkg-config --cflags fluidsynth)
NATIVE_LINK_FLAGS += $(shell pkg-config --libs fluidsynth) NATIVE_LINK_FLAGS += $(shell pkg-config --libs fluidsynth)
endif endif


ifeq ($(HAVE_LINUXSAMPLER),true) ifeq ($(HAVE_LINUXSAMPLER),true)
NATIVE_BUILD_FLAGS += -DWANT_LINUXSAMPLER NATIVE_BUILD_FLAGS += -DWANT_LINUXSAMPLER
NATIVE_BUILD_FLAGS += $(shell pkg-config --cflags linuxsampler)
NATIVE_LINK_FLAGS += $(shell pkg-config --libs linuxsampler) NATIVE_LINK_FLAGS += $(shell pkg-config --libs linuxsampler)
endif endif


@@ -503,5 +502,6 @@ clean:
rm -f $(OBJS_POSIX64) rm -f $(OBJS_POSIX64)
rm -f $(OBJS_WIN32) rm -f $(OBJS_WIN32)
rm -f $(OBJS_WIN64) rm -f $(OBJS_WIN64)
rm -f carla-bridge-lv2-gtk2 carla-bridge-lv2-gtk3 carla-bridge-lv2-qt4 carla-bridge-lv2-qt5 carla-bridge-lv2-x11 carla-bridge-vst-x11
rm -f carla-bridge-lv2-gtk2 carla-bridge-lv2-gtk3 carla-bridge-lv2-qt4 carla-bridge-lv2-qt5 carla-bridge-lv2-x11
rm -f carla-bridge-vst-x11
rm -f carla-bridge-native carla-bridge-posix32 carla-bridge-posix64 rm -f carla-bridge-native carla-bridge-posix32 carla-bridge-posix64

Loading…
Cancel
Save