From 35f8e2dfccadd8f879325f69935f0bf3c64a5142 Mon Sep 17 00:00:00 2001 From: falkTX Date: Thu, 14 Mar 2013 15:43:35 +0000 Subject: [PATCH] Testing --- source/backend/standalone/Makefile | 2 +- source/discovery/Makefile | 5 ++--- source/discovery/carla-discovery.cpp | 8 ++++---- source/tests/ANSI.cpp | 6 ++++-- source/tests/Makefile | 14 +++++++------- source/utils/CarlaBackendUtils.hpp | 10 ++++++++-- source/utils/CarlaUtils.hpp | 23 +++++++++++++++-------- 7 files changed, 41 insertions(+), 27 deletions(-) diff --git a/source/backend/standalone/Makefile b/source/backend/standalone/Makefile index dde7f4f15..de78b24de 100644 --- a/source/backend/standalone/Makefile +++ b/source/backend/standalone/Makefile @@ -10,7 +10,7 @@ include ../Makefile.mk # Common LINK_FLAGS += $(shell pkg-config --libs gl liblo QtCore QtXml) -LINK_FLAGS += -X11 +LINK_FLAGS += -lX11 # -------------------------------------------------------------- # Engine diff --git a/source/discovery/Makefile b/source/discovery/Makefile index 456bce54d..53457089c 100644 --- a/source/discovery/Makefile +++ b/source/discovery/Makefile @@ -9,8 +9,6 @@ include ../Makefile.mk # -------------------------------------------------------------- BUILD_CXX_FLAGS += -I../backend -I../includes -I../utils -BUILD_CXX_FLAGS += $(shell pkg-config --cflags QtCore) -LINK_FLAGS += $(shell pkg-config --libs QtCore) ifeq ($(CARLA_PLUGIN_SUPPORT),true) BUILD_CXX_FLAGS += -DWANT_LADSPA -DWANT_DSSI -DWANT_LV2 -DWANT_VST @@ -34,7 +32,8 @@ POSIX_LINK_FLAGS = $(LINK_FLAGS) -ldl WIN_BUILD_FLAGS = $(BUILD_CXX_FLAGS) WIN_32BIT_FLAGS = $(32BIT_FLAGS) WIN_64BIT_FLAGS = $(64BIT_FLAGS) -WIN_LINK_FLAGS = $(LINK_FLAGS) -static -mwindows -lole32 -luuid -lws2_32 +WIN_LINK_FLAGS = $(LINK_FLAGS) -static -mwindows +# -lole32 -luuid -lws2_32 ifeq ($(CARLA_PLUGIN_SUPPORT),true) LIBS = ../libs/lilv.a diff --git a/source/discovery/carla-discovery.cpp b/source/discovery/carla-discovery.cpp index 7338a76cd..d16d6b847 100644 --- a/source/discovery/carla-discovery.cpp +++ b/source/discovery/carla-discovery.cpp @@ -16,10 +16,10 @@ */ #include "CarlaBackendUtils.hpp" -#include "CarlaJuceUtils.hpp" -#include "CarlaLibUtils.hpp" -#include "CarlaString.hpp" -#include "CarlaMIDI.h" +//#include "CarlaJuceUtils.hpp" +//#include "CarlaLibUtils.hpp" +//#include "CarlaString.hpp" +//#include "CarlaMIDI.h" #ifdef WANT_LADSPA # include "CarlaLadspaUtils.hpp" diff --git a/source/tests/ANSI.cpp b/source/tests/ANSI.cpp index 1b7b9fda0..c3f187a83 100644 --- a/source/tests/ANSI.cpp +++ b/source/tests/ANSI.cpp @@ -20,7 +20,7 @@ //#include "plugin/DssiPlugin.cpp" //#include "../widgets/digitalpeakmeter.cpp" -#include "CarlaJuceHeader.hpp" +#include "CarlaUtils.hpp" #if 0 #include "CarlaDefines.hpp" @@ -53,7 +53,9 @@ #include "RtList.hpp" #endif -int main() +#include "Utils.cpp" + +int main2() { return 0; } diff --git a/source/tests/Makefile b/source/tests/Makefile index 450d8dce8..56fdea144 100644 --- a/source/tests/Makefile +++ b/source/tests/Makefile @@ -9,7 +9,7 @@ include ../Makefile.mk # -------------------------------------------------------------- BUILD_CXX_FLAGS += -I../backend -I../includes -I../libs -I../utils -Wall -Wextra -BUILD_CXX_FLAGS += -isystem ../libs/juce +# BUILD_CXX_FLAGS += -isystem ../libs/juce # BUILD_CXX_FLAGS += -DWANT_JACK -DWANT_LADSPA -DWANT_DSSI # BUILD_CXX_FLAGS += -isystem /usr/include/qt4 # BUILD_CXX_FLAGS += -isystem ../backend/engine/rtaudio-4.0.11 @@ -20,14 +20,14 @@ ANSI_CXX_FLAGS += -Wcast-qual -Wconversion -Wsign-conversion -Wlogical-op -Wagg ANSI_CXX_FLAGS += -std=c++11 -Wzero-as-null-pointer-constant ANSI_CXX_FLAGS += -DVESTIGE_HEADER -shared -fPIC -TARGETS = ANSI_ Base64 CarlaString RtList Thread Print +TARGETS = ANSI Base64 CarlaString RtList Thread Print Utils all: $(TARGETS) RUN # -------------------------------------------------------------- -ANSI_: ANSI.cpp - $(CXX) $^ $(BUILD_CXX_FLAGS) $(ANSI_CXX_FLAGS) $(LINK_FLAGS) -o ANSI # $@ +ANSI: ANSI.cpp + $(CXX) $^ $(BUILD_CXX_FLAGS) $(ANSI_CXX_FLAGS) $(LINK_FLAGS) -o $@ Base64: Base64.cpp $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ @@ -44,11 +44,11 @@ Thread: Thread.cpp Print: Print.cpp $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ -GL_: GL.cpp -# $(CXX) $^ $(BUILD_CXX_FLAGS) -I../backend/engine/plugin -I../libs/distrho-plugin-toolkit $(LINK_FLAGS) -lgdi32 -lopengl32 -lole32 -luuid -lws2_32 -o GL # $@ - $(CXX) $^ $(BUILD_CXX_FLAGS) -I../backend/engine/plugin -I../libs/distrho-plugin-toolkit $(LINK_FLAGS) -lGL -lGLU -o GL # $@ +Utils: Utils.cpp + $(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) -o $@ RUN: $(TARGETS) + valgrind ./Utils # ./CarlaString && ./RtList && ./Thread # ./Print # ./Base64 diff --git a/source/utils/CarlaBackendUtils.hpp b/source/utils/CarlaBackendUtils.hpp index ad20a0500..a025bb008 100644 --- a/source/utils/CarlaBackendUtils.hpp +++ b/source/utils/CarlaBackendUtils.hpp @@ -420,6 +420,7 @@ const char* getPluginTypeAsString(const PluginType& type) static inline PluginType getPluginTypeFromString(const char* const stype) { + CARLA_ASSERT(stype != nullptr); carla_debug("CarlaBackend::getPluginTypeFromString(%s)", stype); if (stype == nullptr) @@ -440,6 +441,8 @@ PluginType getPluginTypeFromString(const char* const stype) return PLUGIN_LV2; if (std::strcmp(stype, "VST") == 0) return PLUGIN_VST; + if (std::strcmp(stype, "VST3") == 0) + return PLUGIN_VST3; if (std::strcmp(stype, "GIG") == 0) return PLUGIN_GIG; if (std::strcmp(stype, "SF2") == 0) @@ -456,11 +459,14 @@ PluginType getPluginTypeFromString(const char* const stype) static inline PluginCategory getPluginCategoryFromName(const char* const name) { + CARLA_ASSERT(name != nullptr); carla_debug("CarlaBackend::getPluginCategoryFromName(\"%s\")", name); - CARLA_ASSERT(name); - if (! name) + if (name == nullptr) + { + carla_stderr("CarlaBackend::getPluginCategoryFromName() - null name"); return PLUGIN_CATEGORY_NONE; + } CarlaString sname(name); diff --git a/source/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp index 5650ec43d..d8326efcd 100644 --- a/source/utils/CarlaUtils.hpp +++ b/source/utils/CarlaUtils.hpp @@ -54,7 +54,7 @@ void pass() {} static inline void carla_debug(const char* const fmt, ...) { - std::va_list args; + va_list args; va_start(args, fmt); std::fprintf(stdout, "\x1b[30;1m"); std::vfprintf(stdout, fmt, args); @@ -66,7 +66,7 @@ void carla_debug(const char* const fmt, ...) static inline void carla_stdout(const char* const fmt, ...) { - std::va_list args; + va_list args; va_start(args, fmt); std::vfprintf(stdout, fmt, args); std::fprintf(stdout, "\n"); @@ -76,7 +76,7 @@ void carla_stdout(const char* const fmt, ...) static inline void carla_stderr(const char* const fmt, ...) { - std::va_list args; + va_list args; va_start(args, fmt); std::vfprintf(stderr, fmt, args); std::fprintf(stderr, "\n"); @@ -86,7 +86,7 @@ void carla_stderr(const char* const fmt, ...) static inline void carla_stderr2(const char* const fmt, ...) { - std::va_list args; + va_list args; va_start(args, fmt); std::fprintf(stderr, "\x1b[31m"); std::vfprintf(stderr, fmt, args); @@ -224,6 +224,13 @@ const T& carla_min(const T& v1, const T& v2, const T& min) return ((v1 < min || v2 < min) ? min : (v1 < v2 ? v1 : v2)); } +template +static inline +const T& carla_max(const T& v1, const T& v2, const T& max) +{ + return ((v1 > max || v2 > max) ? max : (v1 > v2 ? v1 : v2)); +} + template static inline const T& carla_fixValue(const T& min, const T& max, const T& value) @@ -280,25 +287,25 @@ void carla_fill(T* data, const size_t size, const T v) } static inline -void carla_copyDouble(double* dataDst, double* dataSrc, const size_t size) +void carla_copyDouble(double* const dataDst, double* const dataSrc, const size_t size) { carla_copy(dataDst, dataSrc, size); } static inline -void carla_copyFloat(float* dataDst, float* dataSrc, const size_t size) +void carla_copyFloat(float* const dataDst, float* const dataSrc, const size_t size) { carla_copy(dataDst, dataSrc, size); } static inline -void carla_zeroDouble(double* data, const size_t size) +void carla_zeroDouble(double* const data, const size_t size) { carla_fill(data, size, 0.0); } static inline -void carla_zeroFloat(float* data, const size_t size) +void carla_zeroFloat(float* const data, const size_t size) { carla_fill(data, size, 0.0f); }