From f8a8648e000094a8d110ca85e246b6f9b61132b1 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 29 May 2013 10:19:32 +0100 Subject: [PATCH] Several build fixes for gcc4.2/non-c++11 --- source/backend/engine/CarlaEngine.cpp | 2 + source/backend/engine/CarlaEngineBridge.cpp | 1 + source/backend/engine/CarlaEngineRtAudio.cpp | 30 +++---- source/backend/native/audio-base.hpp | 9 +++ source/backend/native/midi-base.hpp | 12 ++- source/backend/plugin/BridgePlugin.cpp | 2 + source/backend/plugin/CarlaPlugin.cpp | 80 +++++++++++-------- source/backend/plugin/CarlaPluginInternal.hpp | 6 +- source/backend/plugin/FluidSynthPlugin.cpp | 9 +++ source/backend/plugin/Lv2Plugin.cpp | 12 ++- source/backend/plugin/NativePlugin.cpp | 12 ++- source/backend/plugin/VstPlugin.cpp | 7 ++ source/backend/standalone/Makefile | 12 ++- source/bridges/CarlaBridgeUI-LV2.cpp | 3 + source/bridges/Makefile | 10 ++- source/libs/distrho/DistrhoUtils.hpp | 22 ++++- source/theme/CarlaStyle.cpp | 2 +- source/theme/CarlaStyle.hpp | 2 + source/theme/CarlaStyleAnimations.hpp | 2 + source/theme/Makefile | 2 +- source/utils/CarlaUtils.hpp | 23 +++--- source/widgets/Makefile | 2 +- source/widgets/digitalpeakmeter.hpp | 2 + source/widgets/ledbutton.hpp | 2 + source/widgets/paramspinbox.hpp | 2 + source/widgets/pixmapdial.hpp | 2 + source/widgets/pixmapkeyboard.cpp | 23 ++++-- source/widgets/pixmapkeyboard.hpp | 2 + 28 files changed, 211 insertions(+), 84 deletions(-) diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 338facfc2..bd7f451af 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -20,6 +20,8 @@ #include "CarlaStateUtils.hpp" #include "CarlaMIDI.h" +#include + #include #include #include diff --git a/source/backend/engine/CarlaEngineBridge.cpp b/source/backend/engine/CarlaEngineBridge.cpp index 5bd9d3f16..62ff6e316 100644 --- a/source/backend/engine/CarlaEngineBridge.cpp +++ b/source/backend/engine/CarlaEngineBridge.cpp @@ -26,6 +26,7 @@ #include "jackbridge/JackBridge.hpp" +#include #include CARLA_BACKEND_START_NAMESPACE diff --git a/source/backend/engine/CarlaEngineRtAudio.cpp b/source/backend/engine/CarlaEngineRtAudio.cpp index 7286f057b..770682aef 100644 --- a/source/backend/engine/CarlaEngineRtAudio.cpp +++ b/source/backend/engine/CarlaEngineRtAudio.cpp @@ -334,7 +334,7 @@ public: fConnectName.clear(); - for (auto it = fMidiIns.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fMidiIns.begin(); it.valid(); it.next()) { MidiPort& port(*it); RtMidiIn* const midiInPort((RtMidiIn*)port.rtmidi); @@ -343,7 +343,7 @@ public: delete midiInPort; } - for (auto it = fMidiOuts.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fMidiOuts.begin(); it.valid(); it.next()) { MidiPort& port(*it); RtMidiOut* const midiOutPort((RtMidiOut*)port.rtmidi); @@ -504,7 +504,7 @@ public: return false; } - for (auto it=fUsedConnections.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it=fUsedConnections.begin(); it.valid(); it.next()) { const ConnectionToId& connection(*it); @@ -517,7 +517,7 @@ public: { const int portId(targetPort-PATCHBAY_GROUP_MIDI_OUT*1000); - for (auto it=fMidiOuts.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) { MidiPort& midiPort(*it); @@ -536,7 +536,7 @@ public: { const int portId(targetPort-PATCHBAY_GROUP_MIDI_IN*1000); - for (auto it=fMidiIns.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) { MidiPort& midiPort(*it); @@ -690,7 +690,7 @@ public: // Connections fConnectAudioLock.lock(); - for (auto it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountIn); @@ -706,7 +706,7 @@ public: fLastConnectionId++; } - for (auto it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountIn); @@ -722,7 +722,7 @@ public: fLastConnectionId++; } - for (auto it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountOut); @@ -738,7 +738,7 @@ public: fLastConnectionId++; } - for (auto it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountOut); @@ -756,7 +756,7 @@ public: fConnectAudioLock.unlock(); - for (auto it=fMidiIns.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it=fMidiIns.begin(); it.valid(); it.next()) { const MidiPort& midiPort(*it); @@ -771,7 +771,7 @@ public: fLastConnectionId++; } - for (auto it=fMidiOuts.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it=fMidiOuts.begin(); it.valid(); it.next()) { const MidiPort& midiPort(*it); @@ -934,7 +934,7 @@ protected: { bool first = true; - for (auto it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioIns[0].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountIn); @@ -960,7 +960,7 @@ protected: { bool first = true; - for (auto it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioIns[1].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountIn); @@ -984,7 +984,7 @@ protected: // connect output buffers if (fConnectedAudioOuts[0].count() != 0) { - for (auto it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioOuts[0].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountOut); @@ -995,7 +995,7 @@ protected: if (fConnectedAudioOuts[1].count() != 0) { - for (auto it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fConnectedAudioOuts[1].begin(); it.valid(); it.next()) { const uint& port(*it); CARLA_ASSERT(port < fAudioCountOut); diff --git a/source/backend/native/audio-base.hpp b/source/backend/native/audio-base.hpp index 6dd1a6c7e..f62fad2ca 100644 --- a/source/backend/native/audio-base.hpp +++ b/source/backend/native/audio-base.hpp @@ -33,10 +33,19 @@ struct AudioFilePool { uint32_t startFrame; uint32_t size; +#ifdef CARLA_PROPER_CPP11_SUPPORT AudioFilePool() : buffer{nullptr}, startFrame(0), size(0) {} +#else + AudioFilePool() + : startFrame(0), + size(0) + { + buffer[0] = buffer[1] = nullptr; + } +#endif ~AudioFilePool() { diff --git a/source/backend/native/midi-base.hpp b/source/backend/native/midi-base.hpp index 2eb916dfb..117e0923c 100644 --- a/source/backend/native/midi-base.hpp +++ b/source/backend/native/midi-base.hpp @@ -32,9 +32,17 @@ struct RawMidiEvent { uint32_t time; RawMidiEvent() +#ifdef CARLA_PROPER_CPP11_SUPPORT : data{0}, size(0), time(0) {} +#else + : size(0), + time(0) + { + carla_fill(data, MAX_EVENT_DATA_SIZE, 0); + } +#endif }; class AbstractMidiPlayer @@ -172,7 +180,7 @@ public: if (! fMutex.tryLock()) return; - for (auto it = fData.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fData.begin(); it.valid(); it.next()) { const RawMidiEvent* const rawMidiEvent(*it); @@ -211,7 +219,7 @@ private: return; } - for (auto it = fData.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fData.begin(); it.valid(); it.next()) { const RawMidiEvent* const oldEvent(*it); diff --git a/source/backend/plugin/BridgePlugin.cpp b/source/backend/plugin/BridgePlugin.cpp index d75c61466..c5611cf42 100644 --- a/source/backend/plugin/BridgePlugin.cpp +++ b/source/backend/plugin/BridgePlugin.cpp @@ -24,6 +24,8 @@ #include "jackbridge/JackBridge.hpp" +#include +#include #include #include diff --git a/source/backend/plugin/CarlaPlugin.cpp b/source/backend/plugin/CarlaPlugin.cpp index 2cff6829e..27894e352 100644 --- a/source/backend/plugin/CarlaPlugin.cpp +++ b/source/backend/plugin/CarlaPlugin.cpp @@ -56,7 +56,7 @@ public: const CarlaMutex::ScopedLocker sl(&mutex); - for (auto it = libs.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = libs.begin(); it.valid(); it.next()) { Lib& lib(*it); @@ -72,7 +72,11 @@ public: if (libPtr == nullptr) return nullptr; +#ifdef CARLA_PROPER_CPP11_SUPPORT Lib lib{libPtr, carla_strdup(filename), 1}; +#else + Lib lib(libPtr, carla_strdup(filename)); +#endif libs.append(lib); return libPtr; @@ -87,7 +91,7 @@ public: const CarlaMutex::ScopedLocker sl(&mutex); - for (auto it = libs.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = libs.begin(); it.valid(); it.next()) { Lib& lib(*it); @@ -116,6 +120,13 @@ private: void* const lib; const char* const filename; int count; + +#ifndef CARLA_PROPER_CPP11_SUPPORT + Lib(void* const lib_, const char* const filename_) + : lib(lib_), + filename(filename_), + count(1) {} +#endif }; CarlaMutex mutex; @@ -728,7 +739,7 @@ const SaveState& CarlaPlugin::getSaveState() // ---------------------------- // Custom Data - for (auto it = kData->custom.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = kData->custom.begin(); it.valid(); it.next()) { const CustomData& cData(*it); @@ -747,6 +758,31 @@ const SaveState& CarlaPlugin::getSaveState() return saveState; } + +struct ParamSymbol { + uint32_t index; + const char* symbol; + + ParamSymbol(uint32_t index_, const char* symbol_) + : index(index_), + symbol(carla_strdup(symbol_)) {} + + void free() + { + if (symbol != nullptr) + { + delete[] symbol; + symbol = nullptr; + } + } + +#ifdef CARLA_PROPER_CPP11_SUPPORT + ParamSymbol() = delete; + ParamSymbol(ParamSymbol&) = delete; + ParamSymbol(const ParamSymbol&) = delete; +#endif +}; + void CarlaPlugin::loadSaveState(const SaveState& saveState) { char strBuf[STR_MAX+1]; @@ -754,7 +790,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) // --------------------------------------------------------------------- // Part 1 - set custom data (except binary/chunks) - for (auto it = saveState.customData.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = saveState.customData.begin(); it.valid(); it.next()) { const StateCustomData* const stateCustomData(*it); @@ -812,28 +848,6 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) // --------------------------------------------------------------------- // Part 4a - get plugin parameter symbols - struct ParamSymbol { - uint32_t index; - const char* symbol; - - ParamSymbol(uint32_t index_, const char* symbol_) - : index(index_), - symbol(carla_strdup(symbol_)) {} - - void free() - { - if (symbol != nullptr) - { - delete[] symbol; - symbol = nullptr; - } - } - - ParamSymbol() = delete; - ParamSymbol(ParamSymbol&) = delete; - ParamSymbol(const ParamSymbol&) = delete; - }; - NonRtList paramSymbols; if (type() == PLUGIN_LADSPA || type() == PLUGIN_LV2) @@ -855,7 +869,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) const float sampleRate(kData->engine->getSampleRate()); - for (auto it = saveState.parameters.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = saveState.parameters.begin(); it.valid(); it.next()) { StateParameter* const stateParameter(*it); @@ -866,7 +880,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) // Try to set by symbol, otherwise use index if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) { - for (auto it = paramSymbols.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) { ParamSymbol* const paramSymbol(*it); @@ -887,7 +901,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) // Symbol only if (stateParameter->symbol != nullptr && *stateParameter->symbol != 0) { - for (auto it = paramSymbols.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) { ParamSymbol* const paramSymbol(*it); @@ -926,7 +940,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) } // clear - for (auto it = paramSymbols.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = paramSymbols.begin(); it.valid(); it.next()) { ParamSymbol* const paramSymbol(*it); paramSymbol->free(); @@ -938,7 +952,7 @@ void CarlaPlugin::loadSaveState(const SaveState& saveState) // --------------------------------------------------------------------- // Part 5 - set chunk data - for (auto it = saveState.customData.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = saveState.customData.begin(); it.valid(); it.next()) { const StateCustomData* const stateCustomData(*it); @@ -1372,7 +1386,7 @@ void CarlaPlugin::setCustomData(const char* const type, const char* const key, c return; // Check if we already have this key - for (auto it = kData->custom.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = kData->custom.begin(); it.valid(); it.next()) { CustomData& cData(*it); @@ -1805,7 +1819,7 @@ void CarlaPlugin::updateOscData(const lo_address& source, const char* const url) osc_send_sample_rate(&kData->osc.data, kData->engine->getSampleRate()); - for (auto it = kData->custom.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = kData->custom.begin(); it.valid(); it.next()) { const CustomData& cData(*it); diff --git a/source/backend/plugin/CarlaPluginInternal.hpp b/source/backend/plugin/CarlaPluginInternal.hpp index d110b9fe6..3ca0d30a1 100644 --- a/source/backend/plugin/CarlaPluginInternal.hpp +++ b/source/backend/plugin/CarlaPluginInternal.hpp @@ -518,9 +518,11 @@ struct CarlaPluginProtectedData { OSC(CarlaEngine* const engine, CarlaPlugin* const plugin) : thread(engine, plugin) {} +#ifdef CARLA_PROPER_CPP11_SUPPORT OSC() = delete; OSC(OSC&) = delete; OSC(const OSC&) = delete; +#endif CARLA_LEAK_DETECTOR(OSC) } osc; @@ -539,9 +541,11 @@ struct CarlaPluginProtectedData { latencyBuffers(nullptr), osc(engine, plugin) {} +#ifdef CARLA_PROPER_CPP11_SUPPORT CarlaPluginProtectedData() = delete; CarlaPluginProtectedData(CarlaPluginProtectedData&) = delete; CarlaPluginProtectedData(const CarlaPluginProtectedData&) = delete; +#endif CARLA_LEAK_DETECTOR(CarlaPluginProtectedData) ~CarlaPluginProtectedData() @@ -579,7 +583,7 @@ struct CarlaPluginProtectedData { client = nullptr; } - for (auto it = custom.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = custom.begin(); it.valid(); it.next()) { CustomData& cData(*it); diff --git a/source/backend/plugin/FluidSynthPlugin.cpp b/source/backend/plugin/FluidSynthPlugin.cpp index c401b5b43..2dab6559f 100644 --- a/source/backend/plugin/FluidSynthPlugin.cpp +++ b/source/backend/plugin/FluidSynthPlugin.cpp @@ -42,12 +42,21 @@ public: fSettings(nullptr), fSynth(nullptr), fSynthId(-1), +#ifdef CARLA_PROPER_CPP11_SUPPORT fAudio16Buffers(nullptr), fParamBuffers{0.0f}, fCurMidiProgs{0} +#else + fAudio16Buffers(nullptr) +#endif { carla_debug("FluidSynthPlugin::FluidSynthPlugin(%p, %i, %s)", engine, id, bool2str(use16Outs)); +#ifndef CARLA_PROPER_CPP11_SUPPORT + carla_zeroFloat(fParamBuffers, FluidSynthParametersMax); + carla_fill(fCurMidiProgs, MAX_MIDI_CHANNELS, 0); +#endif + // create settings fSettings = new_fluid_settings(); CARLA_ASSERT(fSettings != nullptr); diff --git a/source/backend/plugin/Lv2Plugin.cpp b/source/backend/plugin/Lv2Plugin.cpp index 0a9fd72f7..b760ce6b8 100644 --- a/source/backend/plugin/Lv2Plugin.cpp +++ b/source/backend/plugin/Lv2Plugin.cpp @@ -357,7 +357,9 @@ public: : CarlaPlugin(engine, id), fHandle(nullptr), fHandle2(nullptr), +#ifdef CARLA_PROPER_CPP11_SUPPORT fFeatures{nullptr}, +#endif fDescriptor(nullptr), fRdfDescriptor(nullptr), fAudioInBuffers(nullptr), @@ -367,6 +369,10 @@ public: { carla_debug("Lv2Plugin::Lv2Plugin(%p, %i)", engine, id); +#ifndef CARLA_PROPER_CPP11_SUPPORT + carla_fill(fFeatures, kFeatureCount+1, nullptr); +#endif + kData->osc.thread.setMode(CarlaPluginThread::PLUGIN_THREAD_LV2_GUI); for (uint32_t i=0; i < CARLA_URI_MAP_ID_COUNT; ++i) @@ -503,7 +509,7 @@ public: delete fFeatures[i]; } - for (auto it = fCustomURIDs.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = fCustomURIDs.begin(); it.valid(); it.next()) { const char*& uri(*it); @@ -3584,7 +3590,7 @@ protected: } // Check if we already have this key - for (auto it = kData->custom.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = kData->custom.begin(); it.valid(); it.next()) { CustomData& data(*it); @@ -3646,7 +3652,7 @@ protected: const char* stype = nullptr; const char* stringData = nullptr; - for (auto it = kData->custom.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = kData->custom.begin(); it.valid(); it.next()) { CustomData& data(*it); diff --git a/source/backend/plugin/NativePlugin.cpp b/source/backend/plugin/NativePlugin.cpp index 6024725a3..8450dd70c 100644 --- a/source/backend/plugin/NativePlugin.cpp +++ b/source/backend/plugin/NativePlugin.cpp @@ -168,11 +168,19 @@ public: fIsUiVisible(false), fAudioInBuffers(nullptr), fAudioOutBuffers(nullptr), +#ifdef CARLA_PROPER_CPP11_SUPPORT fMidiEventCount(0), fCurMidiProgs{0} +#else + fMidiEventCount(0) +#endif { carla_debug("NativePlugin::NativePlugin(%p, %i)", engine, id); +#ifndef CARLA_PROPER_CPP11_SUPPORT + carla_fill(fCurMidiProgs, MAX_MIDI_CHANNELS, 0); +#endif + carla_zeroStruct< ::MidiEvent>(fMidiEvents, MAX_MIDI_EVENTS*2); fHost.handle = this; @@ -697,7 +705,7 @@ public: // Update UI values, FIXME? (remove?) if (fDescriptor->ui_set_custom_data != nullptr) { - for (auto it = kData->custom.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = kData->custom.begin(); it.valid(); it.next()) { const CustomData& cData(*it); @@ -2166,7 +2174,7 @@ public: // --------------------------------------------------------------- // get descriptor that matches label - for (auto it = sPluginDescriptors.begin(); it.valid(); it.next()) + for (NonRtList::Itenerator it = sPluginDescriptors.begin(); it.valid(); it.next()) { fDescriptor = *it; diff --git a/source/backend/plugin/VstPlugin.cpp b/source/backend/plugin/VstPlugin.cpp index fa7911e96..3458f0721 100644 --- a/source/backend/plugin/VstPlugin.cpp +++ b/source/backend/plugin/VstPlugin.cpp @@ -2345,8 +2345,15 @@ private: FixedVstEvents() : numEvents(0), +#ifdef CARLA_PROPER_CPP11_SUPPORT reserved(0), data{nullptr} {} +#else + reserved(0) + { + carla_fill(data, MAX_MIDI_EVENTS*2, nullptr); + } +#endif } fEvents; struct GuiInfo { diff --git a/source/backend/standalone/Makefile b/source/backend/standalone/Makefile index 589d986fd..83ceeb51e 100644 --- a/source/backend/standalone/Makefile +++ b/source/backend/standalone/Makefile @@ -58,8 +58,12 @@ ifeq ($(HAVE_LINUXSAMPLER),true) W32_LIBS += -lrpcrt4 endif else +ifeq ($(MACOS),true) +DGL_LIBS = -framework Cocoa +else DGL_LIBS = -lX11 endif +endif ifeq ($(HAVE_AF_DEPS),true) LINK_FLAGS += $(shell pkg-config --libs sndfile) @@ -83,9 +87,13 @@ LINK_FLAGS += $(shell pkg-config --libs ntk ntk_images) endif endif -EXTRA_LIBS = -ldl -lrt +EXTRA_LIBS = -ldl LINK_FLAGS += $(EXTRA_LIBS) +ifneq ($(MACOS),true) +EXTRA_LIBS += -lrt +endif + # -------------------------------------------------------------- LIBS = ../libcarla_engine.a @@ -135,7 +143,7 @@ debug: $(CXX) $^ -shared $(LINK_FLAGS) $(W32_LIBS) -Wl,--output-def,$@.def -o $@ && $(STRIP) $@ ../libcarla_standalone.dylib: $(OBJS) $(LIBS) - $(CXX) $^ -dynamiclib $(LINK_FLAGS) -framework CoreAudio -framework CoreMidi -framework CoreFoundation -o $@ + $(CXX) $^ -dynamiclib $(LINK_FLAGS) -framework CoreAudio -framework CoreMIDI -framework CoreFoundation -o $@ ../libcarla_standalone.so: $(OBJS) $(LIBS) $(CXX) $^ -shared $(LINK_FLAGS) -o $@ && $(STRIP) $@ diff --git a/source/bridges/CarlaBridgeUI-LV2.cpp b/source/bridges/CarlaBridgeUI-LV2.cpp index 3bce07527..82cb30860 100644 --- a/source/bridges/CarlaBridgeUI-LV2.cpp +++ b/source/bridges/CarlaBridgeUI-LV2.cpp @@ -20,6 +20,9 @@ #include "CarlaMIDI.h" #include "RtList.hpp" +// TODO - remove +#include + #include extern "C" { diff --git a/source/bridges/Makefile b/source/bridges/Makefile index 4841dbb41..eeccba599 100644 --- a/source/bridges/Makefile +++ b/source/bridges/Makefile @@ -61,7 +61,11 @@ endif POSIX_BUILD_FLAGS = $(BUILD_PLUGIN_FLAGS) 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_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl -lrt +POSIX_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -ldl + +ifneq ($(MACOS),true) +POSIX_LINK_FLAGS += -lrt +endif # -------------------------------------------------------------- # Plugin bridges (Windows) @@ -74,7 +78,11 @@ WIN_LINK_FLAGS = $(LINK_PLUGIN_FLAGS) -mwindows -lwinspool -lole32 -luuid - # -------------------------------------------------------------- # Plugin bridges (Native) +ifeq ($(MACOS),true) +DGL_LIBS = -framework Cocoa +else DGL_LIBS = -lX11 +endif NATIVE_BUILD_FLAGS = $(POSIX_BUILD_FLAGS) NATIVE_LINK_FLAGS = $(POSIX_LINK_FLAGS) diff --git a/source/libs/distrho/DistrhoUtils.hpp b/source/libs/distrho/DistrhoUtils.hpp index 1189059a9..c7c6aeb37 100644 --- a/source/libs/distrho/DistrhoUtils.hpp +++ b/source/libs/distrho/DistrhoUtils.hpp @@ -25,16 +25,30 @@ #include #include +#ifdef PROPER_CPP11_SUPPORT +# include +#else +# include +#endif + #ifdef DISTRHO_OS_WINDOWS # include #else # include #endif -#ifdef PROPER_CPP11_SUPPORT -# include -#else -# include +#if defined(DISTRHO_OS_MAC) && ! defined(CARLA_OS_MAC) +namespace std { +inline float + fmin(float __x, float __y) + { return __builtin_fminf(__x, __y); } +inline float + fmax(float __x, float __y) + { return __builtin_fmaxf(__x, __y); } +inline float + rint(float __x) + { return __builtin_rintf(__x); } +} #endif START_NAMESPACE_DISTRHO diff --git a/source/theme/CarlaStyle.cpp b/source/theme/CarlaStyle.cpp index 154272e18..c75b9f070 100644 --- a/source/theme/CarlaStyle.cpp +++ b/source/theme/CarlaStyle.cpp @@ -139,7 +139,7 @@ struct HexString // specialization to enable fast concatenating of our string tokens to a string template -struct QConcatenable> +struct QConcatenable > { typedef HexString type; enum { ExactSize = true }; diff --git a/source/theme/CarlaStyle.hpp b/source/theme/CarlaStyle.hpp index 3e85dc7c0..2f64766f0 100644 --- a/source/theme/CarlaStyle.hpp +++ b/source/theme/CarlaStyle.hpp @@ -19,6 +19,8 @@ #ifndef __CARLA_STYLE_HPP__ #define __CARLA_STYLE_HPP__ +#include "CarlaDefines.hpp" + #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) diff --git a/source/theme/CarlaStyleAnimations.hpp b/source/theme/CarlaStyleAnimations.hpp index 40ff6dfbf..88a28a0d2 100644 --- a/source/theme/CarlaStyleAnimations.hpp +++ b/source/theme/CarlaStyleAnimations.hpp @@ -19,6 +19,8 @@ #ifndef __CARLA_STYLE_ANIMATIONS_HPP__ #define __CARLA_STYLE_ANIMATIONS_HPP__ +#include "CarlaStyle.hpp" + #include #include #include diff --git a/source/theme/Makefile b/source/theme/Makefile index c6002eb01..beecf7742 100644 --- a/source/theme/Makefile +++ b/source/theme/Makefile @@ -8,7 +8,7 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += -fvisibility=hidden -I. +BUILD_CXX_FLAGS += -fvisibility=hidden -I. -I../includes ifeq ($(HAVE_QT5),true) BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) diff --git a/source/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp index 3d2b87ecd..6fa5cde10 100644 --- a/source/utils/CarlaUtils.hpp +++ b/source/utils/CarlaUtils.hpp @@ -379,20 +379,17 @@ void carla_zeroFloat(float* const data, const size_t size) carla_fill(data, size, 0.0f); } -#ifdef CARLA_OS_MAC +#if defined(CARLA_OS_MAC) && ! defined(DISTRHO_OS_MAC) namespace std { -// inline float -// fabs(float __x) -// { return __builtin_fabsf(__x); } -// inline float -// fmin(float __x, float __y) -// { return __builtin_fminf(__x, __y); } -// inline float -// fmax(float __x, float __y) -// { return __builtin_fmaxf(__x, __y); } -// inline float -// rint(float __x) -// { return __builtin_rintf(__x); } +inline float + fmin(float __x, float __y) + { return __builtin_fminf(__x, __y); } +inline float + fmax(float __x, float __y) + { return __builtin_fmaxf(__x, __y); } +inline float + rint(float __x) + { return __builtin_rintf(__x); } } #endif diff --git a/source/widgets/Makefile b/source/widgets/Makefile index 3babfd040..241287342 100644 --- a/source/widgets/Makefile +++ b/source/widgets/Makefile @@ -8,7 +8,7 @@ include ../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += -fvisibility=hidden -I. +BUILD_CXX_FLAGS += -fvisibility=hidden -I. -I../includes ifeq ($(HAVE_QT5),true) BUILD_CXX_FLAGS += $(shell pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets) diff --git a/source/widgets/digitalpeakmeter.hpp b/source/widgets/digitalpeakmeter.hpp index 3f730ed03..02e68e72f 100644 --- a/source/widgets/digitalpeakmeter.hpp +++ b/source/widgets/digitalpeakmeter.hpp @@ -18,6 +18,8 @@ #ifndef __DIGITALPEAKMETER_HPP__ #define __DIGITALPEAKMETER_HPP__ +#include "CarlaDefines.hpp" + #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) diff --git a/source/widgets/ledbutton.hpp b/source/widgets/ledbutton.hpp index db13f1b49..cab9c8b16 100644 --- a/source/widgets/ledbutton.hpp +++ b/source/widgets/ledbutton.hpp @@ -18,6 +18,8 @@ #ifndef __LEDBUTTON_HPP__ #define __LEDBUTTON_HPP__ +#include "CarlaDefines.hpp" + #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) diff --git a/source/widgets/paramspinbox.hpp b/source/widgets/paramspinbox.hpp index 9a45bdd9c..27253a936 100644 --- a/source/widgets/paramspinbox.hpp +++ b/source/widgets/paramspinbox.hpp @@ -18,6 +18,8 @@ #ifndef __PARAMSPINBOX_HPP__ #define __PARAMSPINBOX_HPP__ +#include "CarlaDefines.hpp" + #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) diff --git a/source/widgets/pixmapdial.hpp b/source/widgets/pixmapdial.hpp index 9e7cd7f37..68157fd6f 100644 --- a/source/widgets/pixmapdial.hpp +++ b/source/widgets/pixmapdial.hpp @@ -18,6 +18,8 @@ #ifndef __PIXMAPDIAL_HPP__ #define __PIXMAPDIAL_HPP__ +#include "CarlaDefines.hpp" + #include #if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)) diff --git a/source/widgets/pixmapkeyboard.cpp b/source/widgets/pixmapkeyboard.cpp index c1af43255..67a8fe9bb 100644 --- a/source/widgets/pixmapkeyboard.cpp +++ b/source/widgets/pixmapkeyboard.cpp @@ -22,7 +22,10 @@ #include #include -static std::map kMidiKey2RectMapHorizontal = { +#ifndef HAVE_CPP11_SUPPORT +static std::map kMidiKey2RectMapHorizontal; +#else +static const std::map kMidiKey2RectMapHorizontal = { {0, QRectF(0, 0, 18, 64)}, // C {1, QRectF(13, 0, 11, 42)}, // C# {2, QRectF(18, 0, 25, 64)}, // D @@ -36,8 +39,12 @@ static std::map kMidiKey2RectMapHorizontal = { {10, QRectF(121, 0, 11, 42)}, // A# {11, QRectF(126, 0, 18, 64)} // B }; +#endif -static std::map kMidiKey2RectMapVertical = { +#ifndef HAVE_CPP11_SUPPORT +static std::map kMidiKey2RectMapVertical; +#else +static const std::map kMidiKey2RectMapVertical = { {11, QRectF(0, 0, 64, 18)}, // B {10, QRectF(0, 14, 42, 7)}, // A# {9, QRectF(0, 18, 64, 24)}, // A @@ -51,7 +58,11 @@ static std::map kMidiKey2RectMapVertical = { {1, QRectF(0, 122, 42, 7)}, // C# {0, QRectF(0, 126, 64, 18)} // C }; +#endif +#ifndef HAVE_CPP11_SUPPORT +static std::map kMidiKeyboard2KeyMap; +#else static const std::map kMidiKeyboard2KeyMap = { // 3th octave {Qt::Key_Z, 48}, @@ -80,11 +91,12 @@ static const std::map kMidiKeyboard2KeyMap = { {Qt::Key_7, 70}, {Qt::Key_U, 71} }; +#endif -#ifdef HAVE_CPP11_SUPPORT -static const QVector kBlackNotes = {1, 3, 6, 8, 10}; -#else +#ifndef HAVE_CPP11_SUPPORT static QVector kBlackNotes; +#else +static const QVector kBlackNotes = {1, 3, 6, 8, 10}; #endif PixmapKeyboard::PixmapKeyboard(QWidget* parent) @@ -106,6 +118,7 @@ PixmapKeyboard::PixmapKeyboard(QWidget* parent) #ifndef HAVE_CPP11_SUPPORT if (kBlackNotes.count() == 0) { + // TODO - rest of data kBlackNotes << 1; kBlackNotes << 3; kBlackNotes << 6; diff --git a/source/widgets/pixmapkeyboard.hpp b/source/widgets/pixmapkeyboard.hpp index 2a3cc6a4f..17118c98c 100644 --- a/source/widgets/pixmapkeyboard.hpp +++ b/source/widgets/pixmapkeyboard.hpp @@ -18,6 +18,8 @@ #ifndef __PIXMAPKEYBOARD_HPP__ #define __PIXMAPKEYBOARD_HPP__ +#include "CarlaDefines.hpp" + #include #include