From c025a95f58f167302d16d9015b129d99f4d0b3a2 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 4 Jun 2025 11:52:41 +0200 Subject: [PATCH] test functions to receive data --- test/plugin.h | 12 ++++++++++++ test/plugin_ui.h | 16 ++++++++++++++++ test/product.json | 3 +++ 3 files changed, 31 insertions(+) diff --git a/test/plugin.h b/test/plugin.h index 946b062..4274ca1 100644 --- a/test/plugin.h +++ b/test/plugin.h @@ -179,3 +179,15 @@ static int plugin_state_load(const plugin_state_callbacks *cbs, float cur_sample cbs->unlock(cbs->handle); return 0; } + +#include +#if TEMPLATE_SUPPORTS_MESSAGING +static void plugin_receive_from_ui (plugin *instance, const void *data, size_t bytes) { + (void) instance; + printf("plugin_receive_from_ui %ld bytes at %p: \n", bytes, data); + for (size_t i = 0; i < bytes; i++) { + printf("%d ", ((uint8_t*) data)[i]); + } + printf("plugin_receive_from_ui END \n"); +} +#endif diff --git a/test/plugin_ui.h b/test/plugin_ui.h index 63cc82a..f37acbf 100644 --- a/test/plugin_ui.h +++ b/test/plugin_ui.h @@ -38,6 +38,19 @@ typedef struct { plugin_ui_callbacks cbs; } plugin_ui; +#if TEMPLATE_SUPPORTS_MESSAGING +static void plugin_ui_receive_from_dsp (plugin_ui *instance, const void *data, size_t bytes) { + (void) instance; + printf("plugin_ui_receive_from_ui %ld bytes at %p: \n", bytes, data); + for (size_t i = 0; i < bytes; i++) { + printf("%d ", ((uint8_t*) data)[i]); + } + printf("plugin_ui_receive_from_ui END \n"); +} +#endif +#define RANDOM_DATA_SIZE 11 +const uint8_t random_data[RANDOM_DATA_SIZE] = { 2, 3, 4, 5, 6, 7, 8, 9, 6, 9, 6 }; + #define WIDTH 600.0 #define HEIGHT 400.0 @@ -112,6 +125,9 @@ static void on_mouse_release (window *win, int32_t x, int32_t y, uint32_t state) pui->bypass = !pui->bypass; pui->cbs.set_parameter(pui->cbs.handle, 3, pui->bypass ? 1.f : 0.f); draw_button(pui, 3, pui->bypass); +#if TEMPLATE_SUPPORTS_MESSAGING + pui->cbs.send_to_dsp(pui->cbs.handle, (const void*) random_data, RANDOM_DATA_SIZE); +#endif } if (pui->param_down != -1) { diff --git a/test/product.json b/test/product.json index 5c4f5cc..865a35f 100644 --- a/test/product.json +++ b/test/product.json @@ -138,6 +138,9 @@ "userResizable": true, "selfResizable": false }, + "messaging": { + "maxSize": 10240 + }, "state": { "dspCustom": true }