@@ -43,6 +43,7 @@ endif | |||||
ifeq ($(DEBUG),true) | ifeq ($(DEBUG),true) | ||||
BASE_FLAGS += -DDEBUG -O0 -g | BASE_FLAGS += -DDEBUG -O0 -g | ||||
LINK_OPTS = | |||||
else | else | ||||
BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden | BASE_FLAGS += -DNDEBUG $(BASE_OPTS) -fvisibility=hidden | ||||
CXXFLAGS += -fvisibility-inlines-hidden | CXXFLAGS += -fvisibility-inlines-hidden | ||||
@@ -97,10 +97,16 @@ enum EnginePortType { | |||||
kEnginePortTypeCV = 2, | kEnginePortTypeCV = 2, | ||||
/*! | /*! | ||||
* Event port type. | |||||
* Event port type (Control or MIDI). | |||||
** \see CarlaEngineEventPort | ** \see CarlaEngineEventPort | ||||
*/ | */ | ||||
kEnginePortTypeEvent = 3 | |||||
kEnginePortTypeEvent = 3, | |||||
/*! | |||||
* OSC port type. | |||||
** \see CarlaEngineOscPort | |||||
*/ | |||||
kEnginePortTypeOSC = 3 | |||||
}; | }; | ||||
/*! | /*! | ||||
@@ -233,19 +239,14 @@ struct EngineOptions { | |||||
bool preferPluginBridges; | bool preferPluginBridges; | ||||
bool preferUiBridges; | bool preferUiBridges; | ||||
bool uisAlwaysOnTop; | bool uisAlwaysOnTop; | ||||
#ifdef WANT_DSSI | |||||
bool useDssiVstChunks; | |||||
#endif | |||||
unsigned int maxParameters; | unsigned int maxParameters; | ||||
unsigned int uiBridgesTimeout; | unsigned int uiBridgesTimeout; | ||||
#ifdef WANT_RTAUDIO | |||||
unsigned int rtaudioNumPeriods; | |||||
unsigned int rtaudioBufferSize; | |||||
unsigned int rtaudioSampleRate; | |||||
CarlaString rtaudioDevice; | |||||
#endif | |||||
unsigned int audioNumPeriods; | |||||
unsigned int audioBufferSize; | |||||
unsigned int audioSampleRate; | |||||
CarlaString audioDevice; | |||||
CarlaString resourceDir; | CarlaString resourceDir; | ||||
@@ -284,17 +285,11 @@ struct EngineOptions { | |||||
preferPluginBridges(false), | preferPluginBridges(false), | ||||
preferUiBridges(true), | preferUiBridges(true), | ||||
uisAlwaysOnTop(true), | uisAlwaysOnTop(true), | ||||
#ifdef WANT_DSSI | |||||
useDssiVstChunks(false), | |||||
#endif | |||||
maxParameters(MAX_DEFAULT_PARAMETERS), | maxParameters(MAX_DEFAULT_PARAMETERS), | ||||
uiBridgesTimeout(4000), | uiBridgesTimeout(4000), | ||||
#ifdef WANT_RTAUDIO | |||||
rtaudioNumPeriods(2), | |||||
rtaudioBufferSize(512), | |||||
rtaudioSampleRate(44100), | |||||
#endif | |||||
resourceDir() {} | |||||
audioNumPeriods(2), | |||||
audioBufferSize(512), | |||||
audioSampleRate(44100) {} | |||||
}; | }; | ||||
/*! | /*! | ||||
@@ -1067,7 +1062,7 @@ public: | |||||
/*! | /*! | ||||
* Force register a plugin into slot \a id. \n | * Force register a plugin into slot \a id. \n | ||||
* This is needed so that we can receive OSC events for the plugin while it initializes. | |||||
* This is needed so we can receive OSC events for a plugin while it initializes. | |||||
*/ | */ | ||||
void registerEnginePlugin(const unsigned int id, CarlaPlugin* const plugin); | void registerEnginePlugin(const unsigned int id, CarlaPlugin* const plugin); | ||||
@@ -56,31 +56,15 @@ CarlaEngineAudioPort::CarlaEngineAudioPort(const CarlaEngine& engine, const bool | |||||
fBuffer(nullptr) | fBuffer(nullptr) | ||||
{ | { | ||||
carla_debug("CarlaEngineAudioPort::CarlaEngineAudioPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); | carla_debug("CarlaEngineAudioPort::CarlaEngineAudioPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); | ||||
if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | |||||
fBuffer = new float[PATCHBAY_BUFFER_SIZE]; | |||||
} | } | ||||
CarlaEngineAudioPort::~CarlaEngineAudioPort() | CarlaEngineAudioPort::~CarlaEngineAudioPort() | ||||
{ | { | ||||
carla_debug("CarlaEngineAudioPort::~CarlaEngineAudioPort()"); | carla_debug("CarlaEngineAudioPort::~CarlaEngineAudioPort()"); | ||||
if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | |||||
{ | |||||
CARLA_ASSERT(fBuffer != nullptr); | |||||
if (fBuffer != nullptr) | |||||
{ | |||||
delete[] fBuffer; | |||||
fBuffer = nullptr; | |||||
} | |||||
} | |||||
} | } | ||||
void CarlaEngineAudioPort::initBuffer() | void CarlaEngineAudioPort::initBuffer() | ||||
{ | { | ||||
if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY && ! fIsInput) | |||||
carla_zeroFloat(fBuffer, PATCHBAY_BUFFER_SIZE); | |||||
} | } | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -95,17 +79,17 @@ CarlaEngineCVPort::CarlaEngineCVPort(const CarlaEngine& engine, const bool isInp | |||||
CarlaEngineCVPort::~CarlaEngineCVPort() | CarlaEngineCVPort::~CarlaEngineCVPort() | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,); | |||||
carla_debug("CarlaEngineCVPort::~CarlaEngineCVPort()"); | carla_debug("CarlaEngineCVPort::~CarlaEngineCVPort()"); | ||||
if (fBuffer != nullptr) | |||||
{ | |||||
delete[] fBuffer; | |||||
fBuffer = nullptr; | |||||
} | |||||
delete[] fBuffer; | |||||
fBuffer = nullptr; | |||||
} | } | ||||
void CarlaEngineCVPort::initBuffer() | void CarlaEngineCVPort::initBuffer() | ||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,); | |||||
carla_zeroFloat(fBuffer, fEngine.getBufferSize()); | carla_zeroFloat(fBuffer, fEngine.getBufferSize()); | ||||
} | } | ||||
@@ -132,7 +116,7 @@ CarlaEngineEventPort::CarlaEngineEventPort(const CarlaEngine& engine, const bool | |||||
carla_debug("CarlaEngineEventPort::CarlaEngineEventPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); | carla_debug("CarlaEngineEventPort::CarlaEngineEventPort(name:\"%s\", %s)", engine.getName(), bool2str(isInput)); | ||||
if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | ||||
fBuffer = new EngineEvent[INTERNAL_EVENT_COUNT]; | |||||
fBuffer = new EngineEvent[kEngineMaxInternalEventCount]; | |||||
} | } | ||||
CarlaEngineEventPort::~CarlaEngineEventPort() | CarlaEngineEventPort::~CarlaEngineEventPort() | ||||
@@ -141,13 +125,10 @@ CarlaEngineEventPort::~CarlaEngineEventPort() | |||||
if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY) | ||||
{ | { | ||||
CARLA_ASSERT(fBuffer != nullptr); | |||||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr,); | |||||
if (fBuffer != nullptr) | |||||
{ | |||||
delete[] fBuffer; | |||||
fBuffer = nullptr; | |||||
} | |||||
delete[] fBuffer; | |||||
fBuffer = nullptr; | |||||
} | } | ||||
} | } | ||||
@@ -156,7 +137,7 @@ void CarlaEngineEventPort::initBuffer() | |||||
if (fEngine.getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK || fEngine.getProccessMode() == PROCESS_MODE_BRIDGE) | if (fEngine.getProccessMode() == PROCESS_MODE_CONTINUOUS_RACK || fEngine.getProccessMode() == PROCESS_MODE_BRIDGE) | ||||
fBuffer = fEngine.getInternalEventBuffer(fIsInput); | fBuffer = fEngine.getInternalEventBuffer(fIsInput); | ||||
else if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY && ! fIsInput) | else if (fEngine.getProccessMode() == PROCESS_MODE_PATCHBAY && ! fIsInput) | ||||
carla_zeroStruct<EngineEvent>(fBuffer, INTERNAL_EVENT_COUNT); | |||||
carla_zeroStruct<EngineEvent>(fBuffer, kEngineMaxInternalEventCount); | |||||
} | } | ||||
uint32_t CarlaEngineEventPort::getEventCount() const | uint32_t CarlaEngineEventPort::getEventCount() const | ||||
@@ -167,7 +148,7 @@ uint32_t CarlaEngineEventPort::getEventCount() const | |||||
uint32_t i=0; | uint32_t i=0; | ||||
for (; i < INTERNAL_EVENT_COUNT; ++i) | |||||
for (; i < kEngineMaxInternalEventCount; ++i) | |||||
{ | { | ||||
if (fBuffer[i].type == kEngineEventTypeNull) | if (fBuffer[i].type == kEngineEventTypeNull) | ||||
break; | break; | ||||
@@ -181,7 +162,7 @@ const EngineEvent& CarlaEngineEventPort::getEvent(const uint32_t index) | |||||
CARLA_SAFE_ASSERT_RETURN(fIsInput, kFallbackEngineEvent); | CARLA_SAFE_ASSERT_RETURN(fIsInput, kFallbackEngineEvent); | ||||
CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, kFallbackEngineEvent); | CARLA_SAFE_ASSERT_RETURN(fBuffer != nullptr, kFallbackEngineEvent); | ||||
CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, kFallbackEngineEvent); | CARLA_SAFE_ASSERT_RETURN(fEngine.getProccessMode() != PROCESS_MODE_SINGLE_CLIENT && fEngine.getProccessMode() != PROCESS_MODE_MULTIPLE_CLIENTS, kFallbackEngineEvent); | ||||
CARLA_SAFE_ASSERT_RETURN(index < INTERNAL_EVENT_COUNT, kFallbackEngineEvent); | |||||
CARLA_SAFE_ASSERT_RETURN(index < kEngineMaxInternalEventCount, kFallbackEngineEvent); | |||||
return fBuffer[index]; | return fBuffer[index]; | ||||
} | } | ||||
@@ -202,7 +183,7 @@ void CarlaEngineEventPort::writeControlEvent(const uint32_t time, const uint8_t | |||||
const float fixedValue(carla_fixValue<float>(0.0f, 1.0f, value)); | const float fixedValue(carla_fixValue<float>(0.0f, 1.0f, value)); | ||||
for (uint32_t i=0; i < INTERNAL_EVENT_COUNT; ++i) | |||||
for (uint32_t i=0; i < kEngineMaxInternalEventCount; ++i) | |||||
{ | { | ||||
if (fBuffer[i].type != kEngineEventTypeNull) | if (fBuffer[i].type != kEngineEventTypeNull) | ||||
continue; | continue; | ||||
@@ -230,7 +211,7 @@ void CarlaEngineEventPort::writeMidiEvent(const uint32_t time, const uint8_t cha | |||||
CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | CARLA_SAFE_ASSERT_RETURN(data != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(size > 0 && size <= 4,); | CARLA_SAFE_ASSERT_RETURN(size > 0 && size <= 4,); | ||||
for (uint32_t i=0; i < INTERNAL_EVENT_COUNT; ++i) | |||||
for (uint32_t i=0; i < kEngineMaxInternalEventCount; ++i) | |||||
{ | { | ||||
if (fBuffer[i].type != kEngineEventTypeNull) | if (fBuffer[i].type != kEngineEventTypeNull) | ||||
continue; | continue; | ||||
@@ -324,6 +305,8 @@ CarlaEnginePort* CarlaEngineClient::addPort(const EnginePortType portType, const | |||||
return new CarlaEngineCVPort(fEngine, isInput); | return new CarlaEngineCVPort(fEngine, isInput); | ||||
case kEnginePortTypeEvent: | case kEnginePortTypeEvent: | ||||
return new CarlaEngineEventPort(fEngine, isInput); | return new CarlaEngineEventPort(fEngine, isInput); | ||||
case kEnginePortTypeOSC: | |||||
return nullptr; //new CarlaEngineOscPort(fEngine, isInput); | |||||
} | } | ||||
carla_stderr("CarlaEngineClient::addPort(%i, \"%s\", %s) - invalid type", portType, name, bool2str(isInput)); | carla_stderr("CarlaEngineClient::addPort(%i, \"%s\", %s) - invalid type", portType, name, bool2str(isInput)); | ||||
@@ -348,43 +331,6 @@ CarlaEngine::~CarlaEngine() | |||||
delete pData; | delete pData; | ||||
} | } | ||||
// ----------------------------------------------------------------------- | |||||
// Helpers | |||||
// returned value must be deleted | |||||
const char* findDSSIGUI(const char* const filename, const char* const label) | |||||
{ | |||||
// QString guiFilename; | |||||
// QString pluginDir(filename); | |||||
// pluginDir.resize(pluginDir.lastIndexOf(".")); | |||||
// | |||||
// QString shortName(QFileInfo(pluginDir).baseName()); | |||||
// | |||||
// QString checkLabel(label); | |||||
// QString checkSName(shortName); | |||||
// | |||||
// if (! checkLabel.endsWith("_")) checkLabel += "_"; | |||||
// if (! checkSName.endsWith("_")) checkSName += "_"; | |||||
// | |||||
// QStringList guiFiles(QDir(pluginDir).entryList()); | |||||
// | |||||
// foreach (const QString& gui, guiFiles) | |||||
// { | |||||
// if (gui.startsWith(checkLabel) || gui.startsWith(checkSName)) | |||||
// { | |||||
// QFileInfo finalname(pluginDir + QDir::separator() + gui); | |||||
// guiFilename = finalname.absoluteFilePath(); | |||||
// break; | |||||
// } | |||||
// } | |||||
// | |||||
// if (guiFilename.isEmpty()) | |||||
// return nullptr; | |||||
// | |||||
// return carla_strdup(guiFilename.toUtf8().constData()); | |||||
return nullptr; | |||||
} | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
// Static values and calls | // Static values and calls | ||||
@@ -528,8 +474,8 @@ bool CarlaEngine::init(const char* const clientName) | |||||
case PROCESS_MODE_CONTINUOUS_RACK: | case PROCESS_MODE_CONTINUOUS_RACK: | ||||
pData->maxPluginNumber = MAX_RACK_PLUGINS; | pData->maxPluginNumber = MAX_RACK_PLUGINS; | ||||
pData->bufEvents.in = new EngineEvent[INTERNAL_EVENT_COUNT]; | |||||
pData->bufEvents.out = new EngineEvent[INTERNAL_EVENT_COUNT]; | |||||
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount]; | |||||
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount]; | |||||
break; | break; | ||||
case PROCESS_MODE_PATCHBAY: | case PROCESS_MODE_PATCHBAY: | ||||
@@ -538,8 +484,8 @@ bool CarlaEngine::init(const char* const clientName) | |||||
case PROCESS_MODE_BRIDGE: | case PROCESS_MODE_BRIDGE: | ||||
pData->maxPluginNumber = 1; | pData->maxPluginNumber = 1; | ||||
pData->bufEvents.in = new EngineEvent[INTERNAL_EVENT_COUNT]; | |||||
pData->bufEvents.out = new EngineEvent[INTERNAL_EVENT_COUNT]; | |||||
pData->bufEvents.in = new EngineEvent[kEngineMaxInternalEventCount]; | |||||
pData->bufEvents.out = new EngineEvent[kEngineMaxInternalEventCount]; | |||||
break; | break; | ||||
} | } | ||||
@@ -1746,7 +1692,7 @@ void CarlaEngine::processRack(float* inBuf[2], float* outBuf[2], const uint32_t | |||||
// initialize outputs (zero) | // initialize outputs (zero) | ||||
carla_zeroFloat(outBuf[0], frames); | carla_zeroFloat(outBuf[0], frames); | ||||
carla_zeroFloat(outBuf[1], frames); | carla_zeroFloat(outBuf[1], frames); | ||||
carla_zeroMem(pData->bufEvents.out, sizeof(EngineEvent)*INTERNAL_EVENT_COUNT); | |||||
carla_zeroMem(pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); | |||||
bool processed = false; | bool processed = false; | ||||
@@ -1763,12 +1709,12 @@ void CarlaEngine::processRack(float* inBuf[2], float* outBuf[2], const uint32_t | |||||
// initialize inputs (from previous outputs) | // initialize inputs (from previous outputs) | ||||
carla_copyFloat(inBuf[0], outBuf[0], frames); | carla_copyFloat(inBuf[0], outBuf[0], frames); | ||||
carla_copyFloat(inBuf[1], outBuf[1], frames); | carla_copyFloat(inBuf[1], outBuf[1], frames); | ||||
std::memcpy(pData->bufEvents.in, pData->bufEvents.out, sizeof(EngineEvent)*INTERNAL_EVENT_COUNT); | |||||
std::memcpy(pData->bufEvents.in, pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); | |||||
// initialize outputs (zero) | // initialize outputs (zero) | ||||
carla_zeroFloat(outBuf[0], frames); | carla_zeroFloat(outBuf[0], frames); | ||||
carla_zeroFloat(outBuf[1], frames); | carla_zeroFloat(outBuf[1], frames); | ||||
carla_zeroMem(pData->bufEvents.out, sizeof(EngineEvent)*INTERNAL_EVENT_COUNT); | |||||
carla_zeroMem(pData->bufEvents.out, sizeof(EngineEvent)*kEngineMaxInternalEventCount); | |||||
} | } | ||||
// process | // process | ||||
@@ -70,6 +70,8 @@ const char* EnginePortType2Str(const EnginePortType type) | |||||
return "kEnginePortTypeCV"; | return "kEnginePortTypeCV"; | ||||
case kEnginePortTypeEvent: | case kEnginePortTypeEvent: | ||||
return "kEnginePortTypeEvent"; | return "kEnginePortTypeEvent"; | ||||
case kEnginePortTypeOSC: | |||||
return "kEnginePortTypeOSC"; | |||||
} | } | ||||
carla_stderr("CarlaBackend::EnginePortType2Str(%i) - invalid type", type); | carla_stderr("CarlaBackend::EnginePortType2Str(%i) - invalid type", type); | ||||
@@ -118,8 +120,7 @@ const char* EngineControlEventType2Str(const EngineControlEventType type) | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
const unsigned short INTERNAL_EVENT_COUNT = 512; | |||||
const uint32_t PATCHBAY_BUFFER_SIZE = 128; | |||||
const unsigned short kEngineMaxInternalEventCount = 512; | |||||
enum EnginePostAction { | enum EnginePostAction { | ||||
kEnginePostActionNull, | kEnginePostActionNull, | ||||
@@ -133,19 +134,12 @@ struct EnginePluginData { | |||||
float insPeak[2]; | float insPeak[2]; | ||||
float outsPeak[2]; | float outsPeak[2]; | ||||
#ifdef CARLA_PROPER_CPP11_SUPPORT | |||||
EnginePluginData() | |||||
: plugin(nullptr), | |||||
insPeak{0.0f}, | |||||
outsPeak{0.0f} {} | |||||
#else | |||||
EnginePluginData() | EnginePluginData() | ||||
: plugin(nullptr) | : plugin(nullptr) | ||||
{ | { | ||||
insPeak[0] = insPeak[1] = nullptr; | insPeak[0] = insPeak[1] = nullptr; | ||||
outsPeak[0] = outsPeak[1] = nullptr; | outsPeak[0] = outsPeak[1] = nullptr; | ||||
} | } | ||||
#endif | |||||
}; | }; | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
@@ -25,7 +25,7 @@ CARLA_BACKEND_START_NAMESPACE | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
CarlaEngineThread::CarlaEngineThread(CarlaEngine* const engine) | CarlaEngineThread::CarlaEngineThread(CarlaEngine* const engine) | ||||
: juce::Thread("CarlaEngineThread"), | |||||
: Thread("CarlaEngineThread"), | |||||
fEngine(engine) | fEngine(engine) | ||||
{ | { | ||||
CARLA_ASSERT(engine != nullptr); | CARLA_ASSERT(engine != nullptr); | ||||
@@ -60,7 +60,7 @@ void CarlaEngineThread::run() | |||||
for (i=0, count = fEngine->getCurrentPluginCount(); i < count; ++i) | for (i=0, count = fEngine->getCurrentPluginCount(); i < count; ++i) | ||||
{ | { | ||||
CarlaPlugin* const plugin = fEngine->getPluginUnchecked(i); | |||||
CarlaPlugin* const plugin(fEngine->getPluginUnchecked(i)); | |||||
if (plugin == nullptr || ! plugin->isEnabled()) | if (plugin == nullptr || ! plugin->isEnabled()) | ||||
continue; | continue; | ||||
@@ -21,13 +21,15 @@ | |||||
#include "CarlaBackend.hpp" | #include "CarlaBackend.hpp" | ||||
#include "CarlaJuceUtils.hpp" | #include "CarlaJuceUtils.hpp" | ||||
using juce::Thread; | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
#if 0 | #if 0 | ||||
} // Fix editor indentation | } // Fix editor indentation | ||||
#endif | #endif | ||||
class CarlaEngineThread : public juce::Thread | |||||
class CarlaEngineThread : public Thread | |||||
{ | { | ||||
public: | public: | ||||
CarlaEngineThread(CarlaEngine* const engine); | CarlaEngineThread(CarlaEngine* const engine); | ||||
@@ -19,21 +19,12 @@ | |||||
#include "CarlaBackendUtils.hpp" | #include "CarlaBackendUtils.hpp" | ||||
#include "CarlaOscUtils.hpp" | #include "CarlaOscUtils.hpp" | ||||
#include "CarlaEngine.hpp" | #include "CarlaEngine.hpp" | ||||
#include "CarlaPlugin.hpp" | #include "CarlaPlugin.hpp" | ||||
#include "CarlaMIDI.h" | |||||
#include "CarlaNative.h" | #include "CarlaNative.h" | ||||
#include "CarlaLogThread.hpp" | #include "CarlaLogThread.hpp" | ||||
#include "CarlaStyle.hpp" | |||||
// #include <QtCore/QSettings> | |||||
// | |||||
// #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) | |||||
// # include <QtWidgets/QApplication> | |||||
// #else | |||||
// # include <QtGui/QApplication> | |||||
// #endif | |||||
#if ! (defined(DEBUG) || defined(WANT_LOGS) || defined(BUILD_ANSI_TEST)) | #if ! (defined(DEBUG) || defined(WANT_LOGS) || defined(BUILD_ANSI_TEST)) | ||||
# define WANT_LOGS | # define WANT_LOGS | ||||
@@ -46,9 +37,6 @@ using CB::CarlaPlugin; | |||||
using CB::EngineOptions; | using CB::EngineOptions; | ||||
using CB::EngineTimeInfo; | using CB::EngineTimeInfo; | ||||
// TEST | |||||
int main() { return 0; } | |||||
// ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
// Single, standalone engine | // Single, standalone engine | ||||
@@ -263,10 +251,7 @@ const CarlaNativePluginInfo* carla_get_internal_plugin_info(unsigned int interna | |||||
const PluginDescriptor* const nativePlugin(CarlaPlugin::getNativePluginDescriptor(internalPluginId)); | const PluginDescriptor* const nativePlugin(CarlaPlugin::getNativePluginDescriptor(internalPluginId)); | ||||
// as internal plugin, this must never fail | // as internal plugin, this must never fail | ||||
CARLA_ASSERT(nativePlugin != nullptr); | |||||
if (nativePlugin == nullptr) | |||||
return nullptr; | |||||
CARLA_SAFE_ASSERT_RETURN(nativePlugin != nullptr, nullptr); | |||||
info.category = static_cast<CarlaPluginCategory>(nativePlugin->category); | info.category = static_cast<CarlaPluginCategory>(nativePlugin->category); | ||||
info.hints = 0x0; | info.hints = 0x0; | ||||
@@ -11,24 +11,12 @@ include ../Makefile.mk | |||||
BUILD_CXX_FLAGS += -I../../modules/theme | BUILD_CXX_FLAGS += -I../../modules/theme | ||||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) | BUILD_CXX_FLAGS += $(shell pkg-config --cflags liblo) | ||||
ifeq ($(HAVE_QT4),true) | |||||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore QtGui) | |||||
else | |||||
BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Widgets) | |||||
endif | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Common | # Common | ||||
LINK_FLAGS += $(shell pkg-config --libs liblo) | LINK_FLAGS += $(shell pkg-config --libs liblo) | ||||
LINK_FLAGS += -lpthread | LINK_FLAGS += -lpthread | ||||
ifeq ($(HAVE_QT4),true) | |||||
LINK_FLAGS += $(shell pkg-config --libs QtCore QtGui QtXml) | |||||
else | |||||
LINK_FLAGS += $(shell pkg-config --libs Qt5Core Qt5Gui Qt5Xml Qt5Widgets) | |||||
endif | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
# Engine | # Engine | ||||
@@ -101,8 +89,8 @@ endif | |||||
LIBS = ../libcarla_engine.a | LIBS = ../libcarla_engine.a | ||||
LIBS += ../libcarla_plugin.a | LIBS += ../libcarla_plugin.a | ||||
LIBS += ../../modules/carla_native.a | LIBS += ../../modules/carla_native.a | ||||
LIBS += ../../modules/juce_core.a | |||||
LIBS += ../../modules/juce_audio_basics.a | LIBS += ../../modules/juce_audio_basics.a | ||||
LIBS += ../../modules/juce_core.a | |||||
LIBS += ../../modules/rtmempool.a | LIBS += ../../modules/rtmempool.a | ||||
ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ||||
@@ -113,33 +113,6 @@ def findFilenames(filePath, stype): | |||||
return filenames | return filenames | ||||
# FIXME - put this into c++ discovery | |||||
def findDSSIGUI(filename, name, label): | |||||
pluginDir = filename.rsplit(".", 1)[0] | |||||
shortName = os.path.basename(pluginDir) | |||||
guiFilename = "" | |||||
checkName = name.replace(" ", "_") | |||||
checkLabel = label | |||||
checkSName = shortName | |||||
if checkName[-1] != "_": checkName += "_" | |||||
if checkLabel[-1] != "_": checkLabel += "_" | |||||
if checkSName[-1] != "_": checkSName += "_" | |||||
for root, dirs, files in os.walk(pluginDir): | |||||
guiFiles = files | |||||
break | |||||
else: | |||||
guiFiles = [] | |||||
for guiFile in guiFiles: | |||||
if guiFile.startswith((checkName, checkLabel, checkSName)): | |||||
guiFilename = os.path.join(pluginDir, guiFile) | |||||
break | |||||
return guiFilename | |||||
# ------------------------------------------------------------------------------------------------------------ | # ------------------------------------------------------------------------------------------------------------ | ||||
# Plugin Query | # Plugin Query | ||||
@@ -9,6 +9,7 @@ include ../Makefile.mk | |||||
# -------------------------------------------------------------- | # -------------------------------------------------------------- | ||||
BUILD_CXX_FLAGS += -I../backend -I../includes -I../modules -I../utils | BUILD_CXX_FLAGS += -I../backend -I../includes -I../modules -I../utils | ||||
BUILD_CXX_FLAGS += -DWANT_NATIVE | |||||
ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ifeq ($(CARLA_PLUGIN_SUPPORT),true) | ||||
BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST | BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST | ||||
@@ -17,6 +18,10 @@ BUILD_CXX_FLAGS += -DVESTIGE_HEADER | |||||
endif | endif | ||||
endif | endif | ||||
ifeq ($(CARLA_CSOUND_SUPPORT),true) | |||||
NATIVE_FLAGS += -DWANT_CSOUND | |||||
endif | |||||
ifeq ($(HAVE_FLUIDSYNTH),true) | ifeq ($(HAVE_FLUIDSYNTH),true) | ||||
NATIVE_FLAGS += $(shell pkg-config --cflags --libs fluidsynth) -DWANT_FLUIDSYNTH | NATIVE_FLAGS += $(shell pkg-config --cflags --libs fluidsynth) -DWANT_FLUIDSYNTH | ||||
endif | endif | ||||
@@ -30,7 +35,7 @@ endif | |||||
POSIX_BUILD_FLAGS = $(BUILD_CXX_FLAGS) | POSIX_BUILD_FLAGS = $(BUILD_CXX_FLAGS) | ||||
POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu | POSIX_32BIT_FLAGS = $(32BIT_FLAGS) -L/usr/lib32 -L/usr/lib/i386-linux-gnu | ||||
POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu | POSIX_64BIT_FLAGS = $(64BIT_FLAGS) -L/usr/lib64 -L/usr/lib/x86_64-linux-gnu | ||||
POSIX_LINK_FLAGS = $(LINK_FLAGS) -ldl | |||||
POSIX_LINK_FLAGS = $(LINK_FLAGS) $(EXTRA_LIBS) -ldl | |||||
WIN_BUILD_FLAGS = $(BUILD_CXX_FLAGS) | WIN_BUILD_FLAGS = $(BUILD_CXX_FLAGS) | ||||
WIN_32BIT_FLAGS = $(32BIT_FLAGS) | WIN_32BIT_FLAGS = $(32BIT_FLAGS) | ||||
@@ -20,8 +20,6 @@ | |||||
#include "CarlaString.hpp" | #include "CarlaString.hpp" | ||||
#include "CarlaMIDI.h" | #include "CarlaMIDI.h" | ||||
#include "JuceHeader.h" | |||||
#ifdef WANT_LADSPA | #ifdef WANT_LADSPA | ||||
# include "CarlaLadspaUtils.hpp" | # include "CarlaLadspaUtils.hpp" | ||||
#endif | #endif | ||||
@@ -46,6 +44,8 @@ | |||||
# undef TMP__cplusplus | # undef TMP__cplusplus | ||||
#endif | #endif | ||||
#include "juce_core.h" | |||||
#include <iostream> | #include <iostream> | ||||
#define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; | #define DISCOVERY_OUT(x, y) std::cout << "\ncarla-discovery::" << x << "::" << y << std::endl; | ||||
@@ -343,7 +343,7 @@ public: | |||||
DISCOVERY_OUT("label", basename); | DISCOVERY_OUT("label", basename); | ||||
} | } | ||||
DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | |||||
// DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | |||||
DISCOVERY_OUT("audio.outs", 2); | DISCOVERY_OUT("audio.outs", 2); | ||||
DISCOVERY_OUT("audio.total", 2); | DISCOVERY_OUT("audio.total", 2); | ||||
DISCOVERY_OUT("midi.ins", 1); | DISCOVERY_OUT("midi.ins", 1); | ||||
@@ -743,8 +743,14 @@ void do_dssi_check(void*& libHandle, const char* const filename, const bool init | |||||
if (descriptor->run_synth || descriptor->run_multiple_synths) | if (descriptor->run_synth || descriptor->run_multiple_synths) | ||||
midiIns = midiTotal = 1; | midiIns = midiTotal = 1; | ||||
if (midiIns > 0 && audioIns == 0 && audioOuts > 0) | |||||
hints |= PLUGIN_IS_SYNTH; | |||||
// if (midiIns > 0 && audioIns == 0 && audioOuts > 0) | |||||
// hints |= PLUGIN_IS_SYNTH; | |||||
if (const char* const ui = find_dssi_ui(filename, ldescriptor->Label)) | |||||
{ | |||||
hints |= PLUGIN_HAS_GUI; | |||||
delete[] ui; | |||||
} | |||||
if (init) | if (init) | ||||
{ | { | ||||
@@ -1112,8 +1118,8 @@ void do_lv2_check(const char* const bundle, const bool init) | |||||
} | } | ||||
} | } | ||||
if (rdfDescriptor->Type[1] & LV2_PLUGIN_INSTRUMENT) | |||||
hints |= PLUGIN_IS_SYNTH; | |||||
// if (rdfDescriptor->Type[1] & LV2_PLUGIN_INSTRUMENT) | |||||
// hints |= PLUGIN_IS_SYNTH; | |||||
if (rdfDescriptor->UICount > 0) | if (rdfDescriptor->UICount > 0) | ||||
hints |= PLUGIN_HAS_GUI; | hints |= PLUGIN_HAS_GUI; | ||||
@@ -1238,8 +1244,8 @@ void do_vst_check(void*& libHandle, const bool init) | |||||
if (effect->flags & effFlagsHasEditor) | if (effect->flags & effFlagsHasEditor) | ||||
hints |= PLUGIN_HAS_GUI; | hints |= PLUGIN_HAS_GUI; | ||||
if (effect->flags & effFlagsIsSynth) | |||||
hints |= PLUGIN_IS_SYNTH; | |||||
// if (effect->flags & effFlagsIsSynth) | |||||
// hints |= PLUGIN_IS_SYNTH; | |||||
if (vstPluginCanDo(effect, "receiveVstEvents") || vstPluginCanDo(effect, "receiveVstMidiEvent") || (effect->flags & effFlagsIsSynth) > 0) | if (vstPluginCanDo(effect, "receiveVstEvents") || vstPluginCanDo(effect, "receiveVstMidiEvent") || (effect->flags & effFlagsIsSynth) > 0) | ||||
midiIns = 1; | midiIns = 1; | ||||
@@ -1469,7 +1475,7 @@ void do_fluidsynth_check(const char* const filename, const bool init) | |||||
DISCOVERY_OUT("label", (const char*)label); | DISCOVERY_OUT("label", (const char*)label); | ||||
DISCOVERY_OUT("maker", ""); | DISCOVERY_OUT("maker", ""); | ||||
DISCOVERY_OUT("copyright", ""); | DISCOVERY_OUT("copyright", ""); | ||||
DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | |||||
// DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | |||||
DISCOVERY_OUT("audio.outs", 2); | DISCOVERY_OUT("audio.outs", 2); | ||||
DISCOVERY_OUT("audio.total", 2); | DISCOVERY_OUT("audio.total", 2); | ||||
DISCOVERY_OUT("midi.ins", 1); | DISCOVERY_OUT("midi.ins", 1); | ||||
@@ -1490,7 +1496,7 @@ void do_fluidsynth_check(const char* const filename, const bool init) | |||||
DISCOVERY_OUT("name", (const char*)name); | DISCOVERY_OUT("name", (const char*)name); | ||||
DISCOVERY_OUT("label", (const char*)label); | DISCOVERY_OUT("label", (const char*)label); | ||||
DISCOVERY_OUT("copyright", ""); | DISCOVERY_OUT("copyright", ""); | ||||
DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | |||||
// DISCOVERY_OUT("hints", PLUGIN_IS_SYNTH); | |||||
DISCOVERY_OUT("audio.outs", 32); | DISCOVERY_OUT("audio.outs", 32); | ||||
DISCOVERY_OUT("audio.total", 32); | DISCOVERY_OUT("audio.total", 32); | ||||
DISCOVERY_OUT("midi.ins", 1); | DISCOVERY_OUT("midi.ins", 1); | ||||
@@ -1601,6 +1607,19 @@ int main(int argc, char* argv[]) | |||||
const char* const filename = argv[2]; | const char* const filename = argv[2]; | ||||
const PluginType type = getPluginTypeFromString(stype); | const PluginType type = getPluginTypeFromString(stype); | ||||
CarlaString filenameStr(filename); | |||||
if (filenameStr.contains("fluidsynth", true)) | |||||
{ | |||||
DISCOVERY_OUT("info", "skipping fluidsynth based plugin"); | |||||
return 0; | |||||
} | |||||
if (filenameStr.contains("linuxsampler", true)) | |||||
{ | |||||
DISCOVERY_OUT("info", "skipping linuxsampler based plugin"); | |||||
return 0; | |||||
} | |||||
bool openLib = false; | bool openLib = false; | ||||
void* handle = nullptr; | void* handle = nullptr; | ||||
@@ -1627,11 +1646,7 @@ int main(int argc, char* argv[]) | |||||
} | } | ||||
// never do init for dssi-vst, takes too long and it's crashy | // never do init for dssi-vst, takes too long and it's crashy | ||||
#ifdef __USE_GNU | |||||
bool doInit = (strcasestr(filename, "dssi-vst") == nullptr); | |||||
#else | |||||
bool doInit = (std::strstr(filename, "dssi-vst") == nullptr); | |||||
#endif | |||||
bool doInit = ! filenameStr.contains("dssi-vst", true); | |||||
if (doInit && getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") != nullptr) | if (doInit && getenv("CARLA_DISCOVERY_NO_PROCESSING_CHECKS") != nullptr) | ||||
doInit = false; | doInit = false; | ||||
@@ -196,6 +196,7 @@ typedef struct { | |||||
void (*ui_custom_data_changed)(HostHandle handle, const char* key, const char* value); | void (*ui_custom_data_changed)(HostHandle handle, const char* key, const char* value); | ||||
void (*ui_closed)(HostHandle handle); | void (*ui_closed)(HostHandle handle); | ||||
// TODO: add some msgbox call | |||||
const char* (*ui_open_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | const char* (*ui_open_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | ||||
const char* (*ui_save_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | const char* (*ui_save_file)(HostHandle handle, bool isDir, const char* title, const char* filter); | ||||
@@ -19,16 +19,54 @@ | |||||
#define CARLA_DSSI_UTILS_HPP_INCLUDED | #define CARLA_DSSI_UTILS_HPP_INCLUDED | ||||
#include "CarlaLadspaUtils.hpp" | #include "CarlaLadspaUtils.hpp" | ||||
#include "dssi/dssi.h" | #include "dssi/dssi.h" | ||||
#include "juce_core.h" | |||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||
// ... | |||||
static inline | static inline | ||||
bool func() | |||||
const char* find_dssi_ui(const char* const filename, const char* const label) | |||||
{ | { | ||||
return false; | |||||
CARLA_SAFE_ASSERT_RETURN(filename != nullptr, nullptr); | |||||
CARLA_SAFE_ASSERT_RETURN(label != nullptr, nullptr); | |||||
using namespace juce; | |||||
File pluginFile(filename); | |||||
File pluginDir(pluginFile.getParentDirectory()); | |||||
Array<File> results; | |||||
if (pluginDir.findChildFiles(results, File::findFiles|File::ignoreHiddenFiles, false) == 0) | |||||
return nullptr; | |||||
StringArray guiFiles; | |||||
for (int i=0, count=results.size(); i < count; ++i) | |||||
{ | |||||
const File& file(results[i]); | |||||
guiFiles.add(file.getFullPathName()); | |||||
} | |||||
String pluginDirName(pluginDir.getFullPathName()); | |||||
String pluginShortName(pluginFile.getFileNameWithoutExtension()); | |||||
String checkLabel(label); | |||||
String checkShort(pluginShortName); | |||||
if (! checkLabel.endsWith("_")) checkLabel += "_"; | |||||
if (! checkShort.endsWith("_")) checkShort += "_"; | |||||
for (int i=0, count=guiFiles.size(); i < count; ++i) | |||||
{ | |||||
const String& gui(guiFiles[i]); | |||||
if (gui.startsWith(checkLabel) || gui.startsWith(checkShort)) | |||||
return carla_strdup(File(pluginDir).getChildFile(gui).getFullPathName().toRawUTF8()); | |||||
} | |||||
return nullptr; | |||||
} | } | ||||
// ----------------------------------------------------------------------- | // ----------------------------------------------------------------------- | ||||