diff --git a/Makefile b/Makefile index 4fe9dc1..890c0bb 100644 --- a/Makefile +++ b/Makefile @@ -106,6 +106,8 @@ endif # -------------------------------------------------------------- # MOD builds +EXTRA_MOD_FLAGS = -I../include/single-precision -fsingle-precision-constant + ifeq ($(WITH_LTO),true) EXTRA_MOD_FLAGS += -ffat-lto-objects endif @@ -119,9 +121,9 @@ MOD_ENVIRONMENT = \ LD=${1}/host/usr/bin/${2}-ld \ PKG_CONFIG=${1}/host/usr/bin/pkg-config \ STRIP=${1}/host/usr/bin/${2}-strip \ - CFLAGS="-I${1}/staging/usr/include -fsingle-precision-constant $(EXTRA_MOD_FLAGS)" \ + CFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS)" \ CPPFLAGS= \ - CXXFLAGS="-I${1}/staging/usr/include -I../include/single-precision -fsingle-precision-constant $(EXTRA_MOD_FLAGS) -Wno-attributes" \ + CXXFLAGS="-I${1}/staging/usr/include $(EXTRA_MOD_FLAGS) -Wno-attributes" \ LDFLAGS="-L${1}/staging/usr/lib $(EXTRA_MOD_FLAGS)" \ EXE_WRAPPER="qemu-${3}-static -L ${1}/target" \ HEADLESS=true \ diff --git a/dpf b/dpf index 6544084..3106d9a 160000 --- a/dpf +++ b/dpf @@ -1 +1 @@ -Subproject commit 65440847faef769cfcb07a94009642341820dd63 +Subproject commit 3106d9a311c33a677e14828348657d21343c569d diff --git a/src/CardinalPlugin.cpp b/src/CardinalPlugin.cpp index e4e0c5f..b8da754 100644 --- a/src/CardinalPlugin.cpp +++ b/src/CardinalPlugin.cpp @@ -196,6 +196,7 @@ struct Initializer lo_server_add_method(oscServer, "/hello", "", osc_hello_handler, this); lo_server_add_method(oscServer, "/load", "b", osc_load_handler, this); + lo_server_add_method(oscServer, "/screenshot", "b", osc_screenshot_handler, this); lo_server_add_method(oscServer, nullptr, nullptr, osc_fallback_handler, nullptr); startThread(); @@ -302,6 +303,29 @@ struct Initializer LO_TT_IMMEDIATE, "/resp", "ss", "load", ok ? "ok" : "fail"); return 0; } + + static int osc_screenshot_handler(const char*, const char* types, lo_arg** argv, int argc, const lo_message m, void* const self) + { + d_stdout("osc_screenshot_handler()"); + DISTRHO_SAFE_ASSERT_RETURN(argc == 1, 0); + DISTRHO_SAFE_ASSERT_RETURN(types != nullptr && types[0] == 'b', 0); + + const int32_t size = argv[0]->blob.size; + DISTRHO_SAFE_ASSERT_RETURN(size > 4, 0); + + const uint8_t* const blob = (uint8_t*)(&argv[0]->blob.data); + DISTRHO_SAFE_ASSERT_RETURN(blob != nullptr, 0); + + bool ok = false; + + if (CardinalBasePlugin* const plugin = static_cast(self)->oscPlugin) + ok = plugin->updateStateValue("screenshot", String::asBase64(blob, size).buffer()); + + const lo_address source = lo_message_get_source(m); + lo_send_from(source, static_cast(self)->oscServer, + LO_TT_IMMEDIATE, "/resp", "ss", "screenshot", ok ? "ok" : "fail"); + return 0; + } #endif };