diff --git a/source/backend/plugin/VstPlugin.cpp b/source/backend/plugin/VstPlugin.cpp index 343be8c7d..c27e8ec8e 100644 --- a/source/backend/plugin/VstPlugin.cpp +++ b/source/backend/plugin/VstPlugin.cpp @@ -53,7 +53,7 @@ public: carla_debug("VstPlugin::VstPlugin(%p, %i)", engine, id); carla_zeroMem(fMidiEvents, sizeof(VstMidiEvent)*MAX_MIDI_EVENTS*2); - carla_zeroMem(&fTimeInfo, sizeof(VstTimeInfo_R)); + carla_zeroStruct(fTimeInfo); for (unsigned short i=0; i < MAX_MIDI_EVENTS*2; i++) fEvents.data[i] = (VstEvent*)&fMidiEvents[i]; @@ -540,7 +540,7 @@ public: float min, max, def, step, stepSmall, stepLarge; VstParameterProperties prop; - carla_zeroMem(&prop, sizeof(VstParameterProperties)); + carla_zeroStruct(prop); if (fHints & PLUGIN_HAS_COCKOS_EXTENSIONS) { diff --git a/source/bridges/CarlaBridgeToolkitGtk.cpp b/source/bridges/CarlaBridgeToolkitGtk.cpp index 337552699..6785de69f 100644 --- a/source/bridges/CarlaBridgeToolkitGtk.cpp +++ b/source/bridges/CarlaBridgeToolkitGtk.cpp @@ -47,7 +47,7 @@ class CarlaToolkitGtk : public CarlaBridgeToolkit public: CarlaToolkitGtk(CarlaBridgeClient* const client, const char* const uiTitle) : CarlaBridgeToolkit(client, uiTitle), - settings("Cadence", appName) + settings("falkTX", appName) { carla_debug("CarlaToolkitGtk::CarlaToolkitGtk(%p, \"%s\")", client, uiTitle); diff --git a/source/bridges/CarlaBridgeToolkitQt.cpp b/source/bridges/CarlaBridgeToolkitQt.cpp index d1add552f..1ee7edefc 100644 --- a/source/bridges/CarlaBridgeToolkitQt.cpp +++ b/source/bridges/CarlaBridgeToolkitQt.cpp @@ -75,7 +75,7 @@ public: CarlaBridgeToolkitQt(CarlaBridgeClient* const client, const char* const uiTitle) : CarlaBridgeToolkit(client, uiTitle), QObject(nullptr), - settings("Cadence", appName) + settings("falkTX", appName) { qDebug("CarlaBridgeToolkitQt::CarlaBridgeToolkitQt(%p, \"%s\")", client, uiTitle); diff --git a/source/bridges/CarlaBridgeUI-VST.cpp b/source/bridges/CarlaBridgeUI-VST.cpp index b3d294457..2fd535610 100644 --- a/source/bridges/CarlaBridgeUI-VST.cpp +++ b/source/bridges/CarlaBridgeUI-VST.cpp @@ -465,7 +465,7 @@ public: case audioMasterGetVendorString: if (ptr) - std::strcpy((char*)ptr, "Cadence"); + std::strcpy((char*)ptr, "falkTX"); break; case audioMasterGetProductString: diff --git a/source/carla_backend.py b/source/carla_backend.py index ad9ae6998..ad07963ee 100644 --- a/source/carla_backend.py +++ b/source/carla_backend.py @@ -432,8 +432,10 @@ class Host(object): self.lib.carla_transport_relocate(frames) def add_plugin(self, btype, ptype, filename, name, label, extraStuff): - cname = name.encode("utf-8") if name else c_nullptr - return self.lib.carla_add_plugin(btype, ptype, filename.encode("utf-8"), cname, label.encode("utf-8"), cast(extraStuff, c_void_p)) + cfilename = filename.encode("utf-8") if filename else c_nullptr + cname = name.encode("utf-8") if name else c_nullptr + clabel = label.encode("utf-8") if label else c_nullptr + return self.lib.carla_add_plugin(btype, ptype, cfilename, cname, clabel, cast(extraStuff, c_void_p)) def remove_plugin(self, pluginId): return self.lib.carla_remove_plugin(pluginId) diff --git a/source/carla_shared.py b/source/carla_shared.py index 68bce8f14..92e6c14e3 100644 --- a/source/carla_shared.py +++ b/source/carla_shared.py @@ -3320,9 +3320,9 @@ class PluginDatabaseW(QDialog): bridgeText = self.tr("Yes (%s)" % typeText) self.ui.tableWidget.insertRow(index) - self.ui.tableWidget.setItem(index, 0, QTableWidgetItem(plugin['name'])) - self.ui.tableWidget.setItem(index, 1, QTableWidgetItem(plugin['label'])) - self.ui.tableWidget.setItem(index, 2, QTableWidgetItem(plugin['maker'])) + self.ui.tableWidget.setItem(index, 0, QTableWidgetItem(str(plugin['name']))) + self.ui.tableWidget.setItem(index, 1, QTableWidgetItem(str(plugin['label']))) + self.ui.tableWidget.setItem(index, 2, QTableWidgetItem(str(plugin['maker']))) self.ui.tableWidget.setItem(index, 3, QTableWidgetItem(str(plugin['uniqueId']))) self.ui.tableWidget.setItem(index, 4, QTableWidgetItem(str(plugin['audio.ins']))) self.ui.tableWidget.setItem(index, 5, QTableWidgetItem(str(plugin['audio.outs']))) @@ -3333,7 +3333,7 @@ class PluginDatabaseW(QDialog): self.ui.tableWidget.setItem(index, 10, QTableWidgetItem(self.tr("Yes") if (plugin['hints'] & PLUGIN_IS_SYNTH) else self.tr("No"))) self.ui.tableWidget.setItem(index, 11, QTableWidgetItem(bridgeText)) self.ui.tableWidget.setItem(index, 12, QTableWidgetItem(ptype)) - self.ui.tableWidget.setItem(index, 13, QTableWidgetItem(plugin['binary'])) + self.ui.tableWidget.setItem(index, 13, QTableWidgetItem(str(plugin['binary']))) self.ui.tableWidget.item(self.fLastTableIndex, 0).pluginData = plugin self.fLastTableIndex += 1 diff --git a/source/libs/distrho/dgl/Makefile b/source/libs/distrho/dgl/Makefile index 2262c4ce4..0213628dd 100644 --- a/source/libs/distrho/dgl/Makefile +++ b/source/libs/distrho/dgl/Makefile @@ -8,8 +8,7 @@ include ../../../Makefile.mk # -------------------------------------------------------------- -BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -BUILD_CXX_FLAGS += -I. +BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC -I. OBJS = \ src/App.cpp.o \ @@ -22,6 +21,8 @@ OBJS = \ src/Widget.cpp.o \ src/Window.cpp.o +OBJSM = src/pugl/pugl_osx.m.o + STATIC = ../../dgl.a # -------------------------------------------------------------- @@ -29,21 +30,29 @@ STATIC = ../../dgl.a all: $(STATIC) clean: - rm -f $(OBJS) $(SHARED) $(STATIC) + rm -f $(OBJS) $(OBJSM) $(SHARED) $(STATIC) debug: $(MAKE) DEBUG=true # -------------------------------------------------------------- -%.cpp.o: %.cpp - $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ - $(STATIC): $(OBJS) $(AR) rs $@ $^ ../../dgl.dll: $(OBJS) $(CXX) $^ -shared $(LINK_FLAGS) -lopengl32 -lgdi32 -o $@ +../../dgl.dylib: $(OBJS) $(OBJSM) + $(CXX) $^ -shared $(LINK_FLAGS) -framework Cocoa -framework OpenGL -o $@ + ../../dgl.so: $(OBJS) $(CXX) $^ -shared $(LINK_FLAGS) -lX11 -lGL -lGLU -o $@ + +# -------------------------------------------------------------- + +%.cpp.o: %.cpp + $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ + +%.m.o: %.m + $(CC) $< $(BUILD_C_FLAGS) -objc -c -o $@ diff --git a/source/libs/distrho/dgl/src/App.cpp b/source/libs/distrho/dgl/src/App.cpp index 8bcf8af38..cb1851745 100644 --- a/source/libs/distrho/dgl/src/App.cpp +++ b/source/libs/distrho/dgl/src/App.cpp @@ -34,7 +34,7 @@ App::~App() void App::idle() { - for (auto it = kPrivate->fWindows.begin(); it != kPrivate->fWindows.end(); it++) + for (std::list::iterator it = kPrivate->fWindows.begin(); it != kPrivate->fWindows.end(); it++) { Window* window = *it; window->idle(); diff --git a/source/libs/distrho/dgl/src/Window.cpp b/source/libs/distrho/dgl/src/Window.cpp index 3b4b57f51..350a65e51 100644 --- a/source/libs/distrho/dgl/src/Window.cpp +++ b/source/libs/distrho/dgl/src/Window.cpp @@ -19,12 +19,16 @@ #include "../Widget.hpp" #include "../Window.hpp" +#include "pugl/pugl.h" + #if DGL_OS_WINDOWS # include "pugl/pugl_win.cpp" #elif DGL_OS_MAC -# include "pugl/pugl_osx.m" +// compiled separately #elif DGL_OS_LINUX +extern "C" { # include "pugl/pugl_x11.c" +} #else # error Unsupported platform! #endif @@ -32,10 +36,10 @@ #include #define FOR_EACH_WIDGET(it) \ - for (auto it = fWidgets.begin(); it != fWidgets.end(); ++it) + for (std::list::iterator it = fWidgets.begin(); it != fWidgets.end(); ++it) #define FOR_EACH_WIDGET_INV(rit) \ - for (auto rit = fWidgets.rbegin(); rit != fWidgets.rend(); ++rit) + for (std::list::reverse_iterator rit = fWidgets.rbegin(); rit != fWidgets.rend(); ++rit) START_NAMESPACE_DGL @@ -85,11 +89,11 @@ public: puglSetReshapeFunc(kView, onReshapeCallback); puglSetCloseFunc(kView, onCloseCallback); - PuglInternals* impl = kView->impl; - #if DGL_OS_WINDOWS + PuglInternals* impl = kView->impl; hwnd = impl->hwnd; #elif DGL_OS_LINUX + PuglInternals* impl = kView->impl; xDisplay = impl->display; xWindow = impl->win; @@ -307,7 +311,7 @@ protected: FOR_EACH_WIDGET(it) { - Widget* widget = *it; + Widget* const widget(*it); if (widget->isVisible()) widget->onDisplay(); } @@ -320,7 +324,7 @@ protected: FOR_EACH_WIDGET_INV(rit) { - Widget* widget = *rit; + Widget* const widget(*rit); if (widget->isVisible()) { if (widget->onKeyboard(press, key)) @@ -336,7 +340,7 @@ protected: FOR_EACH_WIDGET_INV(rit) { - Widget* widget = *rit; + Widget* const widget(*rit); if (widget->isVisible()) { if (widget->onMouse(button, press, x, y)) @@ -352,7 +356,7 @@ protected: FOR_EACH_WIDGET_INV(rit) { - Widget* widget = *rit; + Widget* const widget(*rit); if (widget->isVisible()) { if (widget->onMotion(x, y)) @@ -368,7 +372,7 @@ protected: FOR_EACH_WIDGET_INV(rit) { - Widget* widget = *rit; + Widget* const widget(*rit); if (widget->isVisible()) { if (widget->onScroll(dx, dy)) @@ -384,7 +388,7 @@ protected: FOR_EACH_WIDGET_INV(rit) { - Widget* widget = *rit; + Widget* const widget(*rit); if (widget->isVisible()) { if (widget->onSpecial(press, key)) @@ -397,7 +401,7 @@ protected: { FOR_EACH_WIDGET(it) { - Widget* widget = *it; + Widget* const widget(*it); widget->onReshape(width, height); } } @@ -411,7 +415,7 @@ protected: FOR_EACH_WIDGET(it) { - Widget* widget = *it; + Widget* const widget(*it); widget->onClose(); } diff --git a/source/libs/distrho/dgl/src/pugl/pugl.h b/source/libs/distrho/dgl/src/pugl/pugl.h index 2a11ad3ed..7695bec9c 100644 --- a/source/libs/distrho/dgl/src/pugl/pugl.h +++ b/source/libs/distrho/dgl/src/pugl/pugl.h @@ -226,7 +226,7 @@ puglCreate(PuglNativeWindow parent, int width, int height, bool resizable, - bool addToDesktop = true); + bool addToDesktop); /** Set the handle to be passed to all callbacks. diff --git a/source/libs/distrho/dgl/src/pugl/pugl_osx.m b/source/libs/distrho/dgl/src/pugl/pugl_osx.m index 29cc122b0..c6fcd7181 100644 --- a/source/libs/distrho/dgl/src/pugl/pugl_osx.m +++ b/source/libs/distrho/dgl/src/pugl/pugl_osx.m @@ -36,8 +36,6 @@ defer:(BOOL)flag; - (void) setPuglview:(PuglView*)view; - (BOOL) windowShouldClose:(id)sender; -- (void) becomeKeyWindow:(id)sender; -- (BOOL) canBecomeKeyWindow:(id)sender; @end @implementation PuglWindow @@ -74,6 +72,14 @@ @end +void +puglDisplay(PuglView* view) +{ + if (view->displayFunc) { + view->displayFunc(view); + } +} + @interface PuglOpenGLView : NSOpenGLView { int colorBits; @@ -169,9 +175,9 @@ } static unsigned -getModifiers(PuglView* view, NSevent* ev) +getModifiers(PuglView* view, NSEvent* ev) { - const unsigned modifierFlags = [ev modifierFlags] + const unsigned modifierFlags = [ev modifierFlags]; view->event_timestamp_ms = fmod([ev timestamp] * 1000.0, UINT32_MAX); @@ -370,14 +376,6 @@ puglDestroy(PuglView* view) free(view); } -void -puglDisplay(PuglView* view) -{ - if (view->displayFunc) { - view->displayFunc(view); - } -} - PuglStatus puglProcessEvents(PuglView* view) { diff --git a/source/utils/CarlaUtils.hpp b/source/utils/CarlaUtils.hpp index 8b3390cc6..5650ec43d 100644 --- a/source/utils/CarlaUtils.hpp +++ b/source/utils/CarlaUtils.hpp @@ -303,6 +303,20 @@ void carla_zeroFloat(float* data, const size_t size) carla_fill(data, size, 0.0f); } +#ifdef 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 + // ------------------------------------------------- // memory functions diff --git a/source/utils/RtList.hpp b/source/utils/RtList.hpp index d303d4e9e..c977a6e5e 100644 --- a/source/utils/RtList.hpp +++ b/source/utils/RtList.hpp @@ -346,7 +346,7 @@ private: if (reset) { reset = false; - carla_zeroMem(&value, sizeof(T)); + carla_zeroStruct(value); } return value;