Signed-off-by: falkTX <falktx@gmail.com>tags/v2.1-alpha2
@@ -172,7 +172,7 @@ endif | |||||
ifeq ($(TESTBUILD),true) | ifeq ($(TESTBUILD),true) | ||||
BASE_FLAGS += -Werror -Wabi=98 -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization | BASE_FLAGS += -Werror -Wabi=98 -Wcast-qual -Wclobbered -Wconversion -Wdisabled-optimization | ||||
BASE_FLAGS += -Wdouble-promotion -Wfloat-equal -Wlogical-op -Wpointer-arith -Wsign-conversion | BASE_FLAGS += -Wdouble-promotion -Wfloat-equal -Wlogical-op -Wpointer-arith -Wsign-conversion | ||||
BASE_FLAGS += -Wformat=2 -Woverlength-strings | |||||
BASE_FLAGS += -Wformat=2 -Woverlength-strings -Wstringop-overflow=4 -Wstringop-truncation | |||||
BASE_FLAGS += -Wmissing-declarations -Wredundant-decls | BASE_FLAGS += -Wmissing-declarations -Wredundant-decls | ||||
BASE_FLAGS += -Wshadow -Wundef -Wuninitialized -Wunused | BASE_FLAGS += -Wshadow -Wundef -Wuninitialized -Wunused | ||||
BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing | BASE_FLAGS += -Wstrict-aliasing -fstrict-aliasing | ||||
@@ -38,13 +38,20 @@ | |||||
#endif | #endif | ||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# endif | |||||
# include "AppConfig.h" | # include "AppConfig.h" | ||||
# if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | |||||
# include "juce_gui_basics/juce_gui_basics.h" | |||||
# else | |||||
# include "juce_events/juce_events.h" | |||||
# include "juce_events/juce_events.h" | |||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | # endif | ||||
# include "juce_core/juce_core.h" | |||||
#endif | #endif | ||||
#define CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(cond, msg, ret) \ | #define CARLA_SAFE_ASSERT_WITH_LAST_ERROR_RETURN(cond, msg, ret) \ | ||||
@@ -10,6 +10,13 @@ endif | |||||
include $(CWD)/Makefile.mk | include $(CWD)/Makefile.mk | ||||
# Workaround GCC bug | |||||
ifeq ($(TESTBUILD),true) | |||||
ifeq ($(USING_JUCE),true) | |||||
BUILD_CXX_FLAGS += -Wno-undef | |||||
endif | |||||
endif | |||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
BINDIR := $(CWD)/../bin | BINDIR := $(CWD)/../bin | ||||
@@ -22,9 +22,26 @@ | |||||
#include "RtLinkedList.hpp" | #include "RtLinkedList.hpp" | ||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wcast-qual" | |||||
# pragma GCC diagnostic ignored "-Wclass-memaccess" | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Wdouble-promotion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wfloat-equal" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||||
#endif | |||||
#include "AppConfig.h" | #include "AppConfig.h" | ||||
#include "juce_audio_devices/juce_audio_devices.h" | #include "juce_audio_devices/juce_audio_devices.h" | ||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
#endif | |||||
CARLA_BACKEND_START_NAMESPACE | CARLA_BACKEND_START_NAMESPACE | ||||
// ------------------------------------------------------------------------------------------------------------------- | // ------------------------------------------------------------------------------------------------------------------- | ||||
@@ -295,8 +312,7 @@ public: | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); | CARLA_SAFE_ASSERT_RETURN(graph != nullptr, false); | ||||
char strBuf[STR_MAX+1]; | |||||
strBuf[STR_MAX] = '\0'; | |||||
char strBuf[STR_MAX]; | |||||
ExternalGraph& extGraph(graph->extGraph); | ExternalGraph& extGraph(graph->extGraph); | ||||
@@ -385,7 +401,8 @@ public: | |||||
ConnectionToId connectionToId; | ConnectionToId connectionToId; | ||||
connectionToId.setData(++(extGraph.connections.lastId), kExternalGraphGroupMidiIn, portId, kExternalGraphGroupCarla, kExternalGraphCarlaPortMidiIn); | connectionToId.setData(++(extGraph.connections.lastId), kExternalGraphGroupMidiIn, portId, kExternalGraphGroupCarla, kExternalGraphCarlaPortMidiIn); | ||||
std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||||
std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||||
strBuf[STR_MAX-1] = '\0'; | |||||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | ||||
@@ -405,7 +422,8 @@ public: | |||||
ConnectionToId connectionToId; | ConnectionToId connectionToId; | ||||
connectionToId.setData(++(extGraph.connections.lastId), kExternalGraphGroupCarla, kExternalGraphCarlaPortMidiOut, kExternalGraphGroupMidiOut, portId); | connectionToId.setData(++(extGraph.connections.lastId), kExternalGraphGroupCarla, kExternalGraphCarlaPortMidiOut, kExternalGraphGroupMidiOut, portId); | ||||
std::snprintf(strBuf, STR_MAX, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||||
std::snprintf(strBuf, STR_MAX-1, "%i:%i:%i:%i", connectionToId.groupA, connectionToId.portA, connectionToId.groupB, connectionToId.portB); | |||||
strBuf[STR_MAX-1] = '\0'; | |||||
callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | callback(ENGINE_CALLBACK_PATCHBAY_CONNECTION_ADDED, connectionToId.id, 0, 0, 0.0f, strBuf); | ||||
@@ -444,7 +462,10 @@ protected: | |||||
void audioDeviceIOCallback(const float** inputChannelData, int numInputChannels, float** outputChannelData, | void audioDeviceIOCallback(const float** inputChannelData, int numInputChannels, float** outputChannelData, | ||||
int numOutputChannels, int numSamples) override | int numOutputChannels, int numSamples) override | ||||
{ | { | ||||
const PendingRtEventsRunner prt(this, numSamples); | |||||
CARLA_SAFE_ASSERT_RETURN(numSamples >= 0,); | |||||
const uint32_t nframes(static_cast<uint32_t>(numSamples)); | |||||
const PendingRtEventsRunner prt(this, nframes); | |||||
// assert juce buffers | // assert juce buffers | ||||
CARLA_SAFE_ASSERT_RETURN(numInputChannels >= 0,); | CARLA_SAFE_ASSERT_RETURN(numInputChannels >= 0,); | ||||
@@ -452,11 +473,9 @@ protected: | |||||
CARLA_SAFE_ASSERT_RETURN(outputChannelData != nullptr,); | CARLA_SAFE_ASSERT_RETURN(outputChannelData != nullptr,); | ||||
CARLA_SAFE_ASSERT_RETURN(numSamples == static_cast<int>(pData->bufferSize),); | CARLA_SAFE_ASSERT_RETURN(numSamples == static_cast<int>(pData->bufferSize),); | ||||
const uint32_t nframes(static_cast<uint32_t>(numSamples)); | |||||
// initialize juce output | // initialize juce output | ||||
for (int i=0; i < numOutputChannels; ++i) | for (int i=0; i < numOutputChannels; ++i) | ||||
carla_zeroFloats(outputChannelData[i], numSamples); | |||||
carla_zeroFloats(outputChannelData[i], nframes); | |||||
// initialize events | // initialize events | ||||
carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); | carla_zeroStructs(pData->events.in, kMaxEngineEventInternalCount); | ||||
@@ -36,9 +36,20 @@ | |||||
#include "CarlaNativePlugin.h" | #include "CarlaNativePlugin.h" | ||||
#if defined(USING_JUCE) && ! (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)) | #if defined(USING_JUCE) && ! (defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN)) | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||||
# endif | |||||
# include "AppConfig.h" | # include "AppConfig.h" | ||||
# include "juce_events/juce_events.h" | # include "juce_events/juce_events.h" | ||||
# define USE_JUCE_MESSAGE_THREAD | # define USE_JUCE_MESSAGE_THREAD | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | |||||
#endif | #endif | ||||
#include "water/files/File.h" | #include "water/files/File.h" | ||||
@@ -108,6 +119,8 @@ protected: | |||||
private: | private: | ||||
volatile bool initialised; | volatile bool initialised; | ||||
CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(SharedJuceMessageThread); | |||||
}; | }; | ||||
#endif | #endif | ||||
@@ -649,23 +662,24 @@ public: | |||||
const uint32_t inChan = 2, uint32_t outChan = 2) | const uint32_t inChan = 2, uint32_t outChan = 2) | ||||
: CarlaEngine(), | : CarlaEngine(), | ||||
pHost(host), | pHost(host), | ||||
#ifdef USE_JUCE_MESSAGE_THREAD | |||||
// if not running inside Carla, we will have to run event loop ourselves | |||||
kNeedsJuceMsgThread(host->dispatcher(pHost->handle, | |||||
NATIVE_HOST_OPCODE_INTERNAL_PLUGIN, 0, 0, nullptr, 0.0f) == 0), | |||||
fJuceMsgThread(), | |||||
#endif | |||||
kIsPatchbay(isPatchbay), | kIsPatchbay(isPatchbay), | ||||
kHasMidiOut(withMidiOut), | kHasMidiOut(withMidiOut), | ||||
fIsActive(false), | fIsActive(false), | ||||
fIsRunning(false), | fIsRunning(false), | ||||
fUiServer(this), | fUiServer(this), | ||||
fOptionsForced(false) | fOptionsForced(false) | ||||
#ifdef USE_JUCE_MESSAGE_THREAD | |||||
// if not running inside Carla, we will have to run event loop ourselves | |||||
, kNeedsJuceMsgThread(host->dispatcher(pHost->handle, | |||||
NATIVE_HOST_OPCODE_INTERNAL_PLUGIN, 0, 0, nullptr, 0.0f) == 0) | |||||
#endif | |||||
{ | { | ||||
carla_debug("CarlaEngineNative::CarlaEngineNative()"); | carla_debug("CarlaEngineNative::CarlaEngineNative()"); | ||||
#ifdef USE_JUCE_MESSAGE_THREAD | #ifdef USE_JUCE_MESSAGE_THREAD | ||||
if (kNeedsJuceMsgThread) | if (kNeedsJuceMsgThread) | ||||
sJuceMsgThread->incRef(); | |||||
fJuceMsgThread->incRef(); | |||||
#endif | #endif | ||||
pData->bufferSize = pHost->get_buffer_size(pHost->handle); | pData->bufferSize = pHost->get_buffer_size(pHost->handle); | ||||
@@ -727,7 +741,7 @@ public: | |||||
#ifdef USE_JUCE_MESSAGE_THREAD | #ifdef USE_JUCE_MESSAGE_THREAD | ||||
if (kNeedsJuceMsgThread) | if (kNeedsJuceMsgThread) | ||||
sJuceMsgThread->decRef(); | |||||
fJuceMsgThread->decRef(); | |||||
#endif | #endif | ||||
carla_debug("CarlaEngineNative::~CarlaEngineNative() - END"); | carla_debug("CarlaEngineNative::~CarlaEngineNative() - END"); | ||||
@@ -2078,6 +2092,11 @@ public: | |||||
private: | private: | ||||
const NativeHostDescriptor* const pHost; | const NativeHostDescriptor* const pHost; | ||||
#ifdef USE_JUCE_MESSAGE_THREAD | |||||
const bool kNeedsJuceMsgThread; | |||||
const juce::SharedResourcePointer<SharedJuceMessageThread> fJuceMsgThread; | |||||
#endif | |||||
const bool kIsPatchbay; // rack if false | const bool kIsPatchbay; // rack if false | ||||
const bool kHasMidiOut; | const bool kHasMidiOut; | ||||
bool fIsActive, fIsRunning; | bool fIsActive, fIsRunning; | ||||
@@ -2085,11 +2104,6 @@ private: | |||||
bool fOptionsForced; | bool fOptionsForced; | ||||
#ifdef USE_JUCE_MESSAGE_THREAD | |||||
const bool kNeedsJuceMsgThread; | |||||
const juce::SharedResourcePointer<SharedJuceMessageThread> sJuceMsgThread; | |||||
#endif | |||||
CarlaPlugin* _getFirstPlugin() const noexcept | CarlaPlugin* _getFirstPlugin() const noexcept | ||||
{ | { | ||||
if (pData->curPluginCount == 0 || pData->plugins == nullptr) | if (pData->curPluginCount == 0 || pData->plugins == nullptr) | ||||
@@ -7,6 +7,13 @@ | |||||
CWD=../.. | CWD=../.. | ||||
include ../Makefile.mk | include ../Makefile.mk | ||||
# Workaround GCC bug | |||||
ifeq ($(TESTBUILD),true) | |||||
ifeq ($(USING_JUCE),true) | |||||
BUILD_CXX_FLAGS += -Wno-undef | |||||
endif | |||||
endif | |||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
OBJS = \ | OBJS = \ | ||||
@@ -22,10 +22,30 @@ | |||||
#include "CarlaBackendUtils.hpp" | #include "CarlaBackendUtils.hpp" | ||||
#include "CarlaMathUtils.hpp" | #include "CarlaMathUtils.hpp" | ||||
#include "JucePluginWindow.hpp" | |||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wcast-qual" | |||||
# pragma GCC diagnostic ignored "-Wclass-memaccess" | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Wdouble-promotion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wfloat-equal" | |||||
# pragma GCC diagnostic ignored "-Woverloaded-virtual" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||||
#endif | |||||
#include "AppConfig.h" | #include "AppConfig.h" | ||||
#include "juce_audio_processors/juce_audio_processors.h" | #include "juce_audio_processors/juce_audio_processors.h" | ||||
#include "juce_gui_basics/juce_gui_basics.h" | |||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
#endif | |||||
#include "JucePluginWindow.hpp" | |||||
namespace juce { | namespace juce { | ||||
extern bool juce_isRunningInWine(); | extern bool juce_isRunningInWine(); | ||||
@@ -54,6 +74,7 @@ public: | |||||
fMidiBuffer(), | fMidiBuffer(), | ||||
fPosInfo(), | fPosInfo(), | ||||
fChunk(), | fChunk(), | ||||
fFormatName(), | |||||
fWindow() | fWindow() | ||||
{ | { | ||||
carla_debug("CarlaPluginJuce::CarlaPluginJuce(%p, %i)", engine, id); | carla_debug("CarlaPluginJuce::CarlaPluginJuce(%p, %i)", engine, id); | ||||
@@ -281,12 +302,10 @@ public: | |||||
int32_t* const set = (int32_t*)dataCompat; | int32_t* const set = (int32_t*)dataCompat; | ||||
dataCompat[39] = dataSize; | |||||
set[0] = (int32_t)juce::ByteOrder::littleEndianInt("CcnK"); | set[0] = (int32_t)juce::ByteOrder::littleEndianInt("CcnK"); | ||||
set[2] = (int32_t)juce::ByteOrder::littleEndianInt("FBCh"); | set[2] = (int32_t)juce::ByteOrder::littleEndianInt("FBCh"); | ||||
set[3] = fxbSwap(1); | set[3] = fxbSwap(1); | ||||
set[39] = fxbSwap(dataSize); | |||||
set[39] = fxbSwap(static_cast<int32_t>(dataSize)); | |||||
{ | { | ||||
const ScopedSingleProcessLocker spl(this, true); | const ScopedSingleProcessLocker spl(this, true); | ||||
@@ -714,7 +733,7 @@ public: | |||||
{ | { | ||||
// disable any output sound | // disable any output sound | ||||
for (uint32_t i=0; i < pData->audioOut.count; ++i) | for (uint32_t i=0; i < pData->audioOut.count; ++i) | ||||
carla_zeroFloats(audioOut[i], static_cast<int>(frames)); | |||||
carla_zeroFloats(audioOut[i], frames); | |||||
return; | return; | ||||
} | } | ||||
@@ -977,9 +996,12 @@ public: | |||||
if (timeInfo.bbt.valid) | if (timeInfo.bbt.valid) | ||||
{ | { | ||||
const double ppqBar = double(timeInfo.bbt.bar - 1) * timeInfo.bbt.beatsPerBar; | |||||
const double ppqBeat = double(timeInfo.bbt.beat - 1); | |||||
const double ppqTick = double(timeInfo.bbt.tick) / timeInfo.bbt.ticksPerBeat; | |||||
CARLA_SAFE_ASSERT_INT(timeInfo.bbt.bar > 0, timeInfo.bbt.bar); | |||||
CARLA_SAFE_ASSERT_INT(timeInfo.bbt.beat > 0, timeInfo.bbt.beat); | |||||
const double ppqBar = static_cast<double>(timeInfo.bbt.beatsPerBar) * (timeInfo.bbt.bar - 1); | |||||
const double ppqBeat = static_cast<double>(timeInfo.bbt.beat - 1); | |||||
const double ppqTick = timeInfo.bbt.tick / timeInfo.bbt.ticksPerBeat; | |||||
fPosInfo.bpm = timeInfo.bbt.beatsPerMinute; | fPosInfo.bpm = timeInfo.bbt.beatsPerMinute; | ||||
@@ -1022,7 +1044,7 @@ public: | |||||
else if (! pData->singleMutex.tryLock()) | else if (! pData->singleMutex.tryLock()) | ||||
{ | { | ||||
for (uint32_t i=0; i < pData->audioOut.count; ++i) | for (uint32_t i=0; i < pData->audioOut.count; ++i) | ||||
carla_zeroFloats(outBuffer[i], static_cast<int>(frames)); | |||||
carla_zeroFloats(outBuffer[i], frames); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -1041,7 +1063,7 @@ public: | |||||
// Set audio out buffers | // Set audio out buffers | ||||
for (uint32_t i=0; i < pData->audioOut.count; ++i) | for (uint32_t i=0; i < pData->audioOut.count; ++i) | ||||
carla_copyFloats(outBuffer[i], fAudioBuffer.getReadPointer(static_cast<int>(i)), static_cast<int>(frames)); | |||||
carla_copyFloats(outBuffer[i], fAudioBuffer.getReadPointer(static_cast<int>(i)), frames); | |||||
// -------------------------------------------------------------------------------------------------------- | // -------------------------------------------------------------------------------------------------------- | ||||
// Midi out | // Midi out | ||||
@@ -1167,7 +1167,7 @@ public: | |||||
CARLA_SAFE_ASSERT_INT(timeInfo.bbt.beat > 0, timeInfo.bbt.beat); | CARLA_SAFE_ASSERT_INT(timeInfo.bbt.beat > 0, timeInfo.bbt.beat); | ||||
const double ppqBar = static_cast<double>(timeInfo.bbt.beatsPerBar) * (timeInfo.bbt.bar - 1); | const double ppqBar = static_cast<double>(timeInfo.bbt.beatsPerBar) * (timeInfo.bbt.bar - 1); | ||||
const double ppqBeat = static_cast<double>(timeInfo.bbt.beat - 1.0); | |||||
const double ppqBeat = static_cast<double>(timeInfo.bbt.beat - 1); | |||||
const double ppqTick = timeInfo.bbt.tick / timeInfo.bbt.ticksPerBeat; | const double ppqTick = timeInfo.bbt.tick / timeInfo.bbt.ticksPerBeat; | ||||
// PPQ Pos | // PPQ Pos | ||||
@@ -7,6 +7,13 @@ | |||||
CWD=../.. | CWD=../.. | ||||
include ../Makefile.mk | include ../Makefile.mk | ||||
# Workaround GCC bug | |||||
ifeq ($(TESTBUILD),true) | |||||
ifeq ($(USING_JUCE),true) | |||||
BUILD_CXX_FLAGS += -Wno-undef | |||||
endif | |||||
endif | |||||
# ---------------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------------- | ||||
OBJS = \ | OBJS = \ | ||||
@@ -1,6 +1,6 @@ | |||||
/* | /* | ||||
* Carla Plugin Host | * Carla Plugin Host | ||||
* Copyright (C) 2011-2018 Filipe Coelho <falktx@falktx.com> | |||||
* Copyright (C) 2011-2019 Filipe Coelho <falktx@falktx.com> | |||||
* | * | ||||
* This program is free software; you can redistribute it and/or | * This program is free software; you can redistribute it and/or | ||||
* modify it under the terms of the GNU General Public License as | * modify it under the terms of the GNU General Public License as | ||||
@@ -24,31 +24,25 @@ | |||||
# include <fluidsynth.h> | # include <fluidsynth.h> | ||||
#endif | #endif | ||||
#ifdef USING_JUCE | |||||
# include "AppConfig.h" | |||||
# include "juce_core/juce_core.h" | |||||
#else | |||||
#if defined(__clang__) | |||||
# pragma clang diagnostic push | |||||
# pragma clang diagnostic ignored "-Wconversion" | |||||
# pragma clang diagnostic ignored "-Weffc++" | |||||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | # pragma GCC diagnostic push | ||||
# pragma GCC diagnostic ignored "-Wconversion" | # pragma GCC diagnostic ignored "-Wconversion" | ||||
# pragma GCC diagnostic ignored "-Weffc++" | # pragma GCC diagnostic ignored "-Weffc++" | ||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | # pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | ||||
#endif | #endif | ||||
#include "rtaudio/RtAudio.h" | |||||
#include "rtmidi/RtMidi.h" | |||||
#if defined(__clang__) | |||||
# pragma clang diagnostic pop | |||||
#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
#ifdef USING_JUCE | |||||
# include "AppConfig.h" | |||||
# include "juce_core/juce_core.h" | |||||
#else | |||||
# include "rtaudio/RtAudio.h" | |||||
# include "rtmidi/RtMidi.h" | |||||
#endif | #endif | ||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
#endif | #endif | ||||
#include "water/files/File.h" | #include "water/files/File.h" | ||||
@@ -43,12 +43,23 @@ | |||||
#endif | #endif | ||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||||
# endif | |||||
# include "AppConfig.h" | # include "AppConfig.h" | ||||
# if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | # if defined(CARLA_OS_MAC) || defined(CARLA_OS_WIN) | ||||
# include "juce_gui_basics/juce_gui_basics.h" | # include "juce_gui_basics/juce_gui_basics.h" | ||||
# else | # else | ||||
# include "juce_events/juce_events.h" | # include "juce_events/juce_events.h" | ||||
# endif | # endif | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | |||||
#endif | #endif | ||||
#include "jackbridge/JackBridge.hpp" | #include "jackbridge/JackBridge.hpp" | ||||
@@ -186,6 +197,9 @@ public: | |||||
CarlaBridgePlugin(const bool useBridge, const char* const clientName, const char* const audioPoolBaseName, | CarlaBridgePlugin(const bool useBridge, const char* const clientName, const char* const audioPoolBaseName, | ||||
const char* const rtClientBaseName, const char* const nonRtClientBaseName, const char* const nonRtServerBaseName) | const char* const rtClientBaseName, const char* const nonRtClientBaseName, const char* const nonRtServerBaseName) | ||||
: fEngine(nullptr), | : fEngine(nullptr), | ||||
#ifdef USING_JUCE | |||||
fJuceInitialiser(), | |||||
#endif | |||||
fUsingBridge(false), | fUsingBridge(false), | ||||
fUsingExec(false) | fUsingExec(false) | ||||
{ | { | ||||
@@ -300,13 +314,14 @@ protected: | |||||
private: | private: | ||||
const CarlaEngine* fEngine; | const CarlaEngine* fEngine; | ||||
bool fUsingBridge; | |||||
bool fUsingExec; | |||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
const juce::ScopedJuceInitialiser_GUI sJuceInitialiser; | |||||
const juce::ScopedJuceInitialiser_GUI fJuceInitialiser; | |||||
#endif | #endif | ||||
bool fUsingBridge; | |||||
bool fUsingExec; | |||||
static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) | static void callback(void* ptr, EngineCallbackOpcode action, unsigned int pluginId, int value1, int value2, float value3, const char* valueStr) | ||||
{ | { | ||||
carla_debug("CarlaBridgePlugin::callback(%p, %i:%s, %i, %i, %i, %f, \"%s\")", ptr, action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | carla_debug("CarlaBridgePlugin::callback(%p, %i:%s, %i, %i, %i, %f, \"%s\")", ptr, action, EngineCallbackOpcode2Str(action), pluginId, value1, value2, value3, valueStr); | ||||
@@ -28,8 +28,21 @@ | |||||
#include "CarlaUtils.h" | #include "CarlaUtils.h" | ||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||||
# endif | |||||
# include "AppConfig.h" | # include "AppConfig.h" | ||||
# include "juce_events/juce_events.h" | # include "juce_events/juce_events.h" | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | |||||
#endif | #endif | ||||
#include "water/files/File.h" | #include "water/files/File.h" | ||||
@@ -55,6 +68,9 @@ public: | |||||
: Lv2PluginBaseClass<EngineTimeInfo>(sampleRate, features), | : Lv2PluginBaseClass<EngineTimeInfo>(sampleRate, features), | ||||
fPlugin(nullptr), | fPlugin(nullptr), | ||||
fUiName() | fUiName() | ||||
#ifdef USING_JUCE | |||||
, fJuceInitialiser() | |||||
#endif | |||||
{ | { | ||||
CARLA_SAFE_ASSERT_RETURN(pData->curPluginCount == 0,) | CARLA_SAFE_ASSERT_RETURN(pData->curPluginCount == 0,) | ||||
CARLA_SAFE_ASSERT_RETURN(pData->plugins == nullptr,); | CARLA_SAFE_ASSERT_RETURN(pData->plugins == nullptr,); | ||||
@@ -473,7 +489,7 @@ private: | |||||
CarlaString fUiName; | CarlaString fUiName; | ||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> sJuceInitialiser; | |||||
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> fJuceInitialiser; | |||||
#endif | #endif | ||||
void updateParameterOutputs() noexcept | void updateParameterOutputs() noexcept | ||||
@@ -8,6 +8,13 @@ CWD=.. | |||||
MODULENAME=carla-bridge | MODULENAME=carla-bridge | ||||
include $(CWD)/Makefile.mk | include $(CWD)/Makefile.mk | ||||
# Workaround GCC bug | |||||
ifeq ($(TESTBUILD),true) | |||||
ifeq ($(USING_JUCE),true) | |||||
BUILD_CXX_FLAGS += -Wno-undef | |||||
endif | |||||
endif | |||||
# ---------------------------------------------------------------------------------------------------------------------- | # ---------------------------------------------------------------------------------------------------------------------- | ||||
BINDIR := $(CWD)/../bin | BINDIR := $(CWD)/../bin | ||||
@@ -286,10 +286,9 @@ CARLA_BRIDGE_UI_END_NAMESPACE | |||||
// ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- | ||||
#if QT_VERSION < QT_VERSION_CHECK(5, 12, 0) | |||||
// missing declaration | |||||
int qInitResources(); | |||||
int qCleanupResources(); | |||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wmissing-declarations" | |||||
#endif | #endif | ||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) | #if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) | ||||
@@ -298,4 +297,8 @@ int qCleanupResources(); | |||||
# include "resources.qt4.cpp" | # include "resources.qt4.cpp" | ||||
#endif | #endif | ||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
#endif | |||||
// ------------------------------------------------------------------------- | // ------------------------------------------------------------------------- |
@@ -7,6 +7,13 @@ | |||||
CWD=.. | CWD=.. | ||||
include $(CWD)/Makefile.mk | include $(CWD)/Makefile.mk | ||||
# Workaround GCC bug | |||||
ifeq ($(TESTBUILD),true) | |||||
ifeq ($(USING_JUCE),true) | |||||
BUILD_CXX_FLAGS += -Wno-undef | |||||
endif | |||||
endif | |||||
# --------------------------------------------------------------------------------------------------------------------- | # --------------------------------------------------------------------------------------------------------------------- | ||||
BINDIR := $(CWD)/../bin | BINDIR := $(CWD)/../bin | ||||
@@ -24,8 +24,19 @@ | |||||
#include "CarlaString.hpp" | #include "CarlaString.hpp" | ||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||||
# endif | |||||
# include "AppConfig.h" | # include "AppConfig.h" | ||||
# include "juce_events/juce_events.h" | # include "juce_events/juce_events.h" | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | |||||
#endif | #endif | ||||
#include "water/files/File.h" | #include "water/files/File.h" | ||||
@@ -57,6 +68,9 @@ public: | |||||
fProgramDesc({0, 0, nullptr}), | fProgramDesc({0, 0, nullptr}), | ||||
#endif | #endif | ||||
fMidiEventCount(0), | fMidiEventCount(0), | ||||
#ifdef USING_JUCE | |||||
fJuceInitialiser(), | |||||
#endif | |||||
fWorkerUISignal(0) | fWorkerUISignal(0) | ||||
{ | { | ||||
carla_zeroStruct(fHost); | carla_zeroStruct(fHost); | ||||
@@ -733,12 +747,12 @@ private: | |||||
uint32_t fMidiEventCount; | uint32_t fMidiEventCount; | ||||
NativeMidiEvent fMidiEvents[kMaxMidiEvents]; | NativeMidiEvent fMidiEvents[kMaxMidiEvents]; | ||||
int fWorkerUISignal; | |||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> sJuceInitialiser; | |||||
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> fJuceInitialiser; | |||||
#endif | #endif | ||||
int fWorkerUISignal; | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
#define handlePtr ((NativePlugin*)handle) | #define handlePtr ((NativePlugin*)handle) | ||||
@@ -43,8 +43,19 @@ | |||||
#include "CarlaVstUtils.hpp" | #include "CarlaVstUtils.hpp" | ||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic push | |||||
# pragma GCC diagnostic ignored "-Wconversion" | |||||
# pragma GCC diagnostic ignored "-Weffc++" | |||||
# pragma GCC diagnostic ignored "-Wsign-conversion" | |||||
# pragma GCC diagnostic ignored "-Wundef" | |||||
# pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" | |||||
# endif | |||||
# include "AppConfig.h" | # include "AppConfig.h" | ||||
# include "juce_events/juce_events.h" | # include "juce_events/juce_events.h" | ||||
# if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) | |||||
# pragma GCC diagnostic pop | |||||
# endif | |||||
#endif | #endif | ||||
static uint32_t d_lastBufferSize = 0; | static uint32_t d_lastBufferSize = 0; | ||||
@@ -76,6 +87,9 @@ public: | |||||
fUiLauncher(nullptr), | fUiLauncher(nullptr), | ||||
fHostType(kHostTypeNull), | fHostType(kHostTypeNull), | ||||
fMidiOutEvents(), | fMidiOutEvents(), | ||||
#ifdef USING_JUCE | |||||
fJuceInitialiser(), | |||||
#endif | |||||
fStateChunk(nullptr) | fStateChunk(nullptr) | ||||
{ | { | ||||
fHost.handle = this; | fHost.handle = this; | ||||
@@ -618,12 +632,12 @@ private: | |||||
CARLA_DECLARE_NON_COPY_STRUCT(FixedVstEvents); | CARLA_DECLARE_NON_COPY_STRUCT(FixedVstEvents); | ||||
} fMidiOutEvents; | } fMidiOutEvents; | ||||
char* fStateChunk; | |||||
#ifdef USING_JUCE | #ifdef USING_JUCE | ||||
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> sJuceInitialiser; | |||||
juce::SharedResourcePointer<juce::ScopedJuceInitialiser_GUI> fJuceInitialiser; | |||||
#endif | #endif | ||||
char* fStateChunk; | |||||
// ------------------------------------------------------------------- | // ------------------------------------------------------------------- | ||||
#define handlePtr ((NativePlugin*)handle) | #define handlePtr ((NativePlugin*)handle) | ||||
@@ -23,9 +23,9 @@ | |||||
#include "AppConfig.h" | #include "AppConfig.h" | ||||
#include "juce_gui_basics/juce_gui_basics.h" | #include "juce_gui_basics/juce_gui_basics.h" | ||||
#if JUCE_LINUX && defined(HAVE_X11) | |||||
#if defined(CARLA_OS_LINUX) && defined(HAVE_X11) | |||||
# include <X11/Xlib.h> | # include <X11/Xlib.h> | ||||
#elif JUCE_MAC | |||||
#elif defined(CARLA_OS_MAC) | |||||
# import <Cocoa/Cocoa.h> | # import <Cocoa/Cocoa.h> | ||||
#endif | #endif | ||||
@@ -98,7 +98,7 @@ private: | |||||
if (fTransientId == 0) | if (fTransientId == 0) | ||||
return; | return; | ||||
#if JUCE_LINUX && defined(HAVE_X11) | |||||
#if defined(CARLA_OS_LINUX) && defined(HAVE_X11) | |||||
Display* const display = XWindowSystem::getInstance()->displayRef(); | Display* const display = XWindowSystem::getInstance()->displayRef(); | ||||
CARLA_SAFE_ASSERT_RETURN(display != nullptr,); | CARLA_SAFE_ASSERT_RETURN(display != nullptr,); | ||||
@@ -109,7 +109,7 @@ private: | |||||
XSetTransientForHint(display, window, static_cast<::Window>(fTransientId)); | XSetTransientForHint(display, window, static_cast<::Window>(fTransientId)); | ||||
#endif | #endif | ||||
#if JUCE_MAC | |||||
#ifdef CARLA_OS_MAC | |||||
NSView* const view = (NSView*)getWindowHandle(); | NSView* const view = (NSView*)getWindowHandle(); | ||||
CARLA_SAFE_ASSERT_RETURN(view != nullptr,); | CARLA_SAFE_ASSERT_RETURN(view != nullptr,); | ||||
@@ -123,7 +123,7 @@ private: | |||||
ordered:NSWindowAbove]; | ordered:NSWindowAbove]; | ||||
#endif | #endif | ||||
#if JUCE_WINDOWS | |||||
#ifdef CARLA_OS_WIN | |||||
const HWND window = (HWND)getWindowHandle(); | const HWND window = (HWND)getWindowHandle(); | ||||
CARLA_SAFE_ASSERT_RETURN(window != nullptr,); | CARLA_SAFE_ASSERT_RETURN(window != nullptr,); | ||||