From c562fb51b480cbf5d6da0ca990063662bdc8f355 Mon Sep 17 00:00:00 2001 From: bsp2 Date: Sat, 27 Oct 2018 12:24:15 +0200 Subject: [PATCH 1/4] Linux: set FPU rounding mode (zero) --- src/vst2_main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vst2_main.cpp b/src/vst2_main.cpp index 72547ae6..f5d6fa32 100644 --- a/src/vst2_main.cpp +++ b/src/vst2_main.cpp @@ -147,6 +147,7 @@ struct PluginMutex { #include #include #include +#include // fesetround() // #define _GNU_SOURCE #include @@ -1190,6 +1191,10 @@ void VSTPluginProcessReplacingFloat32(VSTPlugin *vstPlugin, _MM_SET_FLUSH_ZERO_MODE(_MM_FLUSH_ZERO_ON); #endif // HAVE_WINDOWS +#ifdef YAC_LINUX + fesetround(FE_TOWARDZERO); +#endif // YAC_LINUX + sUI chIdx; if(wrapper->b_idle) From 04ed890ca8d59f1f93e30a04182d07c261bdcced Mon Sep 17 00:00:00 2001 From: bsp2 Date: Sat, 27 Oct 2018 14:29:05 +0200 Subject: [PATCH 2/4] Linux: set FPU rounding mode (zero) --- src/engine.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/engine.cpp b/src/engine.cpp index 609cb2a8..d15a8bab 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -17,6 +17,9 @@ #include "global.hpp" #include "global_ui.hpp" +#ifdef __GNUC__ +#include +#endif namespace rack { @@ -121,6 +124,10 @@ static void engineRun() { _MM_SET_DENORMALS_ZERO_MODE(_MM_DENORMALS_ZERO_ON); #endif // _MSC_VER +#if defined(__GNUC__) && (defined(ARCH_X64) || defined(ARCH_X86)) + ::fesetround(FE_TOWARDZERO); +#endif // __GNUC__ + // Every time the engine waits and locks a mutex, it steps this many frames const int mutexSteps = 64; // Time in seconds that the engine is rushing ahead of the estimated clock time From 81ff8a67b68fa4c3fed7af4e07da5f57228acce4 Mon Sep 17 00:00:00 2001 From: bsp2 Date: Sat, 27 Oct 2018 15:48:50 +0200 Subject: [PATCH 3/4] implement WM_DELETE_WINDOW --- other/vst2_debug_host/vst2_debug_host.cpp | 36 +++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/other/vst2_debug_host/vst2_debug_host.cpp b/other/vst2_debug_host/vst2_debug_host.cpp index 67c6a9b1..278e4db8 100644 --- a/other/vst2_debug_host/vst2_debug_host.cpp +++ b/other/vst2_debug_host/vst2_debug_host.cpp @@ -217,6 +217,14 @@ void open_and_close(void) { BlackPixel(d, s), WhitePixel(d, s) ); XSelectInput(d, w, ExposureMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | EnterWindowMask | LeaveWindowMask | PointerMotionMask | ButtonMotionMask | FocusChangeMask); + + // see + Atom wm_delete_window; + { + wm_delete_window = XInternAtom(d, "WM_DELETE_WINDOW", False); + XSetWMProtocols(d, w, &wm_delete_window, 1); + } + XMapRaised(d, w); XFlush(d); #endif @@ -248,7 +256,8 @@ void open_and_close(void) { if(result == 0) { printf("xxx no XEventProc found, running effEditIdle instead\n"); - for(;;) + bool bRunning = true; + while(bRunning) { XEvent xev; int queued = XPending(d); @@ -266,11 +275,25 @@ void open_and_close(void) { queued = XPending(d); // printf("xxx checking host queue after effEditIdle (events: %i)\n", queued); - while(queued) + while((queued > 0) && bRunning) { XNextEvent(d, &xev); + + // printf("xxx debug_host: xev.type=%d\n", xev.type); + + if(ClientMessage == xev.type) + { + printf("xxx debug_host: ClientMessage\n"); + if((Atom)xev.xclient.data.l[0] == wm_delete_window) + { + printf("xxx debug_host: ClientMessage\n"); + bRunning = false; + } + } + // if(MotionNotify != xev.type) // printf("xxx event type: %i\n", xev.type); + queued--; } @@ -300,6 +323,8 @@ void open_and_close(void) { sleep(1); printf("xxx calling effect->dispatcher\n"); effect->dispatcher(effect, effEditClose, 0, 0, NULL, 0.0f); + +#if 0 sleep(1); printf("xxx calling effect->dispatcher again\n"); #ifdef YAC_WIN32 @@ -311,14 +336,19 @@ void open_and_close(void) { printf("xxx calling effect->dispatcher\n"); effect->dispatcher(effect, effEditIdle, 0, 0, NULL, 0.0f); sleep(1); +#endif + printf("xxx call processreplacing\n"); for(int i = 0; i < 1024; i++) { effect->processReplacing(effect, inputBuffers, outputBuffers, (VstInt32)64); } + +#if 0 printf("xxx calling effect->dispatcher\n"); effect->dispatcher(effect, effEditClose, 0, 0, NULL, 0.0f); sleep(1); +#endif printf("xxx calling effect->dispatcher\n"); effect->dispatcher(effect, effClose, 0, 0, NULL, 0.0f); sleep(1); @@ -355,7 +385,7 @@ void open_and_close(void) { } int main() { - for(int i = 0; i < 5; i++) + for(int i = 0; i < 2; i++) { open_and_close(); } From 90c4134c3a00ec8d083aedcaa15537290be05e3d Mon Sep 17 00:00:00 2001 From: bsp2 Date: Sat, 27 Oct 2018 17:10:09 +0200 Subject: [PATCH 4/4] don't invert "fbo" when saving settings.json --- src/settings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/settings.cpp b/src/settings.cpp index 7518099d..da72c98d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -83,7 +83,7 @@ static json_t *settingsToJson() { json_object_set_new(rootJ, "vsync", vsyncJ); // fbo - json_t *fboJ = json_boolean(!global_ui->b_fbo); + json_t *fboJ = json_boolean(global_ui->b_fbo); json_object_set_new(rootJ, "fbo", fboJ); // touchInput