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