From bb9d68c6338accceb5df78ea7209c50d4acf478c Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Wed, 4 Jun 2025 11:33:36 +0200 Subject: [PATCH 1/8] extended file copy/generation api to allow chmod --- tibia | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tibia b/tibia index 9dd986d..fa6e688 100755 --- a/tibia +++ b/tibia @@ -115,21 +115,27 @@ var doT = require("dot"); doT.templateSettings.strip = false; var api = { - generateFileFromTemplateFile: function (templateFile, outFile, data) { + generateFileFromTemplateFile: function (templateFile, outFile, data, mode) { if (!outputData) return; var dir = outputDir + path.sep + path.dirname(outFile); fs.mkdirSync(dir, { recursive: true }); var t = doT.template(fs.readFileSync(template + path.sep + templateFile, { encoding: "utf-8" })); - fs.writeFileSync(outputDir + path.sep + outFile, t(data), { encoding: "utf-8" }); + var outputFile = outputDir + path.sep + outFile; + fs.writeFileSync(outputFile, t(data), { encoding: "utf-8" }); + if (mode !== undefined) + fs.chmodSync(outputFile, mode); }, - copyFile: function (inFile, outFile) { + copyFile: function (inFile, outFile, mode) { if (!outputCommon) return; var dir = outputDir + path.sep + path.dirname(outFile); fs.mkdirSync(dir, { recursive: true }); - fs.copyFileSync(template + path.sep + inFile, outputDir + path.sep + outFile); + var outputFile = outputDir + path.sep + outFile; + fs.copyFileSync(template + path.sep + inFile, outputFile); + if (mode !== undefined) + fs.chmodSync(outputFile, mode); }, templateDir: template From 9a86ef2de80accfc9f3590b07d229b7889f4885c Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Thu, 5 Jun 2025 08:21:03 +0200 Subject: [PATCH 2/8] use shell pipefail in makefiles --- templates/android-make/Makefile | 2 ++ templates/cmd-make/Makefile | 2 ++ templates/daisy-seed-make/Makefile | 2 ++ templates/ios-make/Makefile | 2 ++ templates/ios/tibia-index.js | 2 +- templates/lv2-make/Makefile | 2 ++ templates/web-demo/rules-extra-web-demo.mk | 2 +- templates/web-make/Makefile | 2 ++ 8 files changed, 14 insertions(+), 2 deletions(-) diff --git a/templates/android-make/Makefile b/templates/android-make/Makefile index 9674e25..99144f1 100644 --- a/templates/android-make/Makefile +++ b/templates/android-make/Makefile @@ -18,6 +18,8 @@ # File author: Stefano D'Angelo # +SHELL := bash -o pipefail + TEMPLATE := android include vars.mk diff --git a/templates/cmd-make/Makefile b/templates/cmd-make/Makefile index 26f4e19..bb4d9d3 100644 --- a/templates/cmd-make/Makefile +++ b/templates/cmd-make/Makefile @@ -18,6 +18,8 @@ # File author: Stefano D'Angelo # +SHELL := bash -o pipefail + TEMPLATE := cmd include vars.mk diff --git a/templates/daisy-seed-make/Makefile b/templates/daisy-seed-make/Makefile index f54f0d8..41a6e18 100644 --- a/templates/daisy-seed-make/Makefile +++ b/templates/daisy-seed-make/Makefile @@ -18,6 +18,8 @@ # File author: Stefano D'Angelo # +SHELL := bash -o pipefail + TEMPLATE := daisy-seed include vars.mk diff --git a/templates/ios-make/Makefile b/templates/ios-make/Makefile index 9536ddc..61459f5 100644 --- a/templates/ios-make/Makefile +++ b/templates/ios-make/Makefile @@ -18,6 +18,8 @@ # File author: Stefano D'Angelo # +SHELL := bash -o pipefail + TEMPLATE := ios include vars.mk diff --git a/templates/ios/tibia-index.js b/templates/ios/tibia-index.js index f7f4c64..8280ce6 100644 --- a/templates/ios/tibia-index.js +++ b/templates/ios/tibia-index.js @@ -26,5 +26,5 @@ module.exports = function (data, api) { api.generateFileFromTemplateFile(`src${sep}index.html`, `src${sep}index.html`, data); api.copyFile(`src${sep}native.mm`, `src${sep}native.mm`); api.copyFile(`src${sep}app-Bridging-Header.h`, `src${sep}app-Bridging-Header.h`); - api.copyFile(`src${sep}app.swift`, `src${sep}app.swift`, data); + api.copyFile(`src${sep}app.swift`, `src${sep}app.swift`); }; diff --git a/templates/lv2-make/Makefile b/templates/lv2-make/Makefile index 872cbac..e4e73e9 100644 --- a/templates/lv2-make/Makefile +++ b/templates/lv2-make/Makefile @@ -18,6 +18,8 @@ # File author: Stefano D'Angelo # +SHELL := bash -o pipefail + TEMPLATE := lv2 include vars.mk diff --git a/templates/web-demo/rules-extra-web-demo.mk b/templates/web-demo/rules-extra-web-demo.mk index 1950e93..97670c0 100644 --- a/templates/web-demo/rules-extra-web-demo.mk +++ b/templates/web-demo/rules-extra-web-demo.mk @@ -24,7 +24,7 @@ build/web/index.html: $(DATA_DIR)/src/index.html | build/web build/web/key.pem: build/web/cert.pem build/web/cert.pem: | build - yes "" | openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes 2>/dev/null + openssl req -x509 -newkey rsa:2048 -keyout build/web/key.pem -out build/web/cert.pem -days 365 -nodes -subj "/C=US/ST=Denial/L=Springfield/O=Dis/CN=www.example.com" 2>/dev/null strip-web-demo: build/web/index.html $(eval TMP := $(shell mktemp /tmp/index.XXXXXX)) diff --git a/templates/web-make/Makefile b/templates/web-make/Makefile index 66526f3..4d1d957 100644 --- a/templates/web-make/Makefile +++ b/templates/web-make/Makefile @@ -18,6 +18,8 @@ # File author: Stefano D'Angelo # +SHELL := bash -o pipefail + TEMPLATE := web include vars.mk From 6695731d0938e9eecbd4b066c143dea4bbd07f53 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Thu, 5 Jun 2025 08:22:52 +0200 Subject: [PATCH 3/8] update copyright headers --- templates/android-make/Makefile | 2 +- templates/daisy-seed-make/Makefile | 2 +- templates/ios-make/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/android-make/Makefile b/templates/android-make/Makefile index 99144f1..ad7aba4 100644 --- a/templates/android-make/Makefile +++ b/templates/android-make/Makefile @@ -1,7 +1,7 @@ # # Tibia # -# Copyright (C) 2023, 2024 Orastron Srl unipersonale +# Copyright (C) 2023-2025 Orastron Srl unipersonale # # Tibia is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/templates/daisy-seed-make/Makefile b/templates/daisy-seed-make/Makefile index 41a6e18..7ef00f2 100644 --- a/templates/daisy-seed-make/Makefile +++ b/templates/daisy-seed-make/Makefile @@ -1,7 +1,7 @@ # # Tibia # -# Copyright (C) 2023, 2024 Orastron Srl unipersonale +# Copyright (C) 2023-2025 Orastron Srl unipersonale # # Tibia is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/templates/ios-make/Makefile b/templates/ios-make/Makefile index 61459f5..756d279 100644 --- a/templates/ios-make/Makefile +++ b/templates/ios-make/Makefile @@ -1,7 +1,7 @@ # # Tibia # -# Copyright (C) 2024 Orastron Srl unipersonale +# Copyright (C) 2024, 2025 Orastron Srl unipersonale # # Tibia is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by From 50118f66a4adcb89e36f030459929ea7a365d969 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Sun, 8 Jun 2025 08:57:35 +0200 Subject: [PATCH 4/8] fix ios issues --- templates/ios-make/Makefile | 2 +- templates/ios/src/native.mm | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/ios-make/Makefile b/templates/ios-make/Makefile index 756d279..0064454 100644 --- a/templates/ios-make/Makefile +++ b/templates/ios-make/Makefile @@ -36,7 +36,7 @@ BUILD_DATA_DIR := build/gen/res -include $(MKINC_DIR)/vars-pre.mk CFLAGS := -O3 -Wall -Wpedantic -Wextra -CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) -fvisiblity=hidden $(CFLAGS_EXTRA) $(CFLAGS) +CFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) -fvisibility=hidden $(CFLAGS_EXTRA) $(CFLAGS) CXXFLAGS := $(CFLAGS) CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) -fvisibility=hidden $(CXXFLAGS_EXTRA) $(CXXFLAGS) diff --git a/templates/ios/src/native.mm b/templates/ios/src/native.mm index 5b87d5c..bf570eb 100644 --- a/templates/ios/src/native.mm +++ b/templates/ios/src/native.mm @@ -164,6 +164,7 @@ void (^midiNotifyBlock)(const MIDINotification *message) = ^(const MIDINotificat }; void (^midiReceiveBlock)(const MIDIEventList *evtlist, void *srcConnRefCon) = ^(const MIDIEventList *evtlist, void *srcConnRefCon) { + (void)srcConnRefCon; const MIDIEventPacket *p = evtlist->packet; for (UInt32 i = 0; i < evtlist->numPackets; i++) { for (UInt32 j = 0; j < p->wordCount; j++) { From 69cff1ebab5ffac5040336ba61b697843293e232 Mon Sep 17 00:00:00 2001 From: Paolo Marrone Date: Tue, 8 Jul 2025 15:15:23 +0200 Subject: [PATCH 5/8] vst3 typo bug fix --- templates/vst3/src/vst3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/vst3/src/vst3.c b/templates/vst3/src/vst3.c index 3a9a580..2bb2eaa 100644 --- a/templates/vst3/src/vst3.c +++ b/templates/vst3/src/vst3.c @@ -2177,7 +2177,7 @@ static struct Steinberg_IPlugView* controllerCreateView(void* thisInterface, Ste controller *c = (controller *)((char *)thisInterface - offsetof(controller, vtblIEditController)); size_t i; - for (i = 0; i < c->viewsCount; c++) + for (i = 0; i < c->viewsCount; i++) if (c->views[i] == NULL) break; if (i == c->viewsCount) { From 1e5d2b49da446a968464ebd1cde5197ec11d998d Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Fri, 18 Jul 2025 11:39:44 +0200 Subject: [PATCH 6/8] add extra fields to product.json for external templates --- test/product.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/product.json b/test/product.json index 5c4f5cc..01b3b30 100644 --- a/test/product.json +++ b/test/product.json @@ -2,7 +2,9 @@ "product": { "name": "Tibia test product", "version": "1.0.0", - "buildVersion": "0", + "buildVersion": 0, + "description": "A toy plugin to test Tibia", + "copyright": "Copyright © 2021-2025 Orastron Srl unipersonale", "bundleName": "tibia-test", "buses": [ { @@ -136,7 +138,8 @@ ], "ui": { "userResizable": true, - "selfResizable": false + "selfResizable": false, + "highResolution": true }, "state": { "dspCustom": true From 59838dda2599319203247f10bf19b7df03957a85 Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Fri, 18 Jul 2025 17:33:23 +0200 Subject: [PATCH 7/8] made lv2 template and test plugin c++ friendly --- templates/lv2-make/Makefile | 2 +- templates/lv2/src/lv2.c | 90 +++++++++++++++++++++++++------------ test/plugin_ui.h | 36 +++++++-------- 3 files changed, 81 insertions(+), 47 deletions(-) diff --git a/templates/lv2-make/Makefile b/templates/lv2-make/Makefile index e4e73e9..e391677 100644 --- a/templates/lv2-make/Makefile +++ b/templates/lv2-make/Makefile @@ -71,7 +71,7 @@ LDFLAGS := LDFLAGS_ALL := -shared $(shell pkg-config --libs lv2) $(LDFLAGS_EXTRA) $(LDFLAGS) CXXFLAGS := $(CFLAGS) -CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) -fPIC $(CXXFLAGS_EXTRA) $(CXXFLAGS) +CXXFLAGS_ALL := -I$(DATA_DIR)/src -I$(PLUGIN_DIR) -I$(API_DIR) $(shell pkg-config --cflags lv2) -fPIC -fvisibility=hidden $(CXXFLAGS_EXTRA) $(CXXFLAGS) ifeq ($(UNAME_S), Darwin) CFLAGS_ALL := $(CFLAGS_ALL) -arch arm64 -arch x86_64 diff --git a/templates/lv2/src/lv2.c b/templates/lv2/src/lv2.c index ba3ce82..48bd638 100644 --- a/templates/lv2/src/lv2.c +++ b/templates/lv2/src/lv2.c @@ -58,7 +58,11 @@ #endif #if (DATA_PRODUCT_CONTROL_INPUTS_N > 0) && defined(DATA_STATE_DSP_CUSTOM) -# include +# ifdef __cplusplus +# include +# else +# include +# endif # if defined(_WIN32) || defined(__CYGWIN__) # include # define yield SwitchToThread @@ -113,7 +117,11 @@ typedef struct { float params[DATA_PRODUCT_CONTROL_INPUTS_N]; # ifdef DATA_STATE_DSP_CUSTOM float params_sync[DATA_PRODUCT_CONTROL_INPUTS_N]; +# ifdef __cplusplus + std::atomic_flag sync_lock_flag; +# else atomic_flag sync_lock_flag; +# endif char synced; char loaded; # endif @@ -142,14 +150,22 @@ static const char * get_bundle_path_cb(void *handle) { #ifdef DATA_STATE_DSP_CUSTOM static void state_lock_cb(void *handle) { plugin_instance * i = (plugin_instance *)handle; +# ifdef __cplusplus + while (i->sync_lock_flag.test_and_set()) +# else while (atomic_flag_test_and_set(&i->sync_lock_flag)) +# endif yield(); i->synced = 0; } static void state_unlock_cb(void *handle) { plugin_instance * i = (plugin_instance *)handle; +# ifdef __cplusplus + i->sync_lock_flag.clear(); +# else atomic_flag_clear(&i->sync_lock_flag); +# endif } static int state_write_cb(void *handle, const char *data, size_t length) { @@ -172,7 +188,12 @@ static LV2_Handle instantiate(const struct LV2_Descriptor * descriptor, double s (void)descriptor; (void)bundle_path; - plugin_instance *instance = malloc(sizeof(plugin_instance)); + // make C++ compilers happy + const char * missing; + plugin_callbacks cbs; + size_t req; + + plugin_instance *instance = (plugin_instance *)malloc(sizeof(plugin_instance)); if (instance == NULL) goto err_instance; @@ -181,7 +202,7 @@ static LV2_Handle instantiate(const struct LV2_Descriptor * descriptor, double s goto err_bundle_path; // from https://lv2plug.in/book - const char * missing = lv2_features_query(features, + missing = lv2_features_query(features, LV2_LOG__log, &instance->logger.log, false, LV2_URID__map, &instance->map, true, NULL); @@ -205,17 +226,15 @@ static LV2_Handle instantiate(const struct LV2_Descriptor * descriptor, double s } #endif - plugin_callbacks cbs = { - /* .handle = */ (void *)instance, - /* .format = */ "lv2", - /* .get_bindir = */ get_bundle_path_cb, - /* .get_datadir = */ get_bundle_path_cb - }; + cbs.handle = (void *)instance; + cbs.format = "lv2"; + cbs.get_bindir = get_bundle_path_cb; + cbs.get_datadir = get_bundle_path_cb; plugin_init(&instance->p, &cbs); instance->sample_rate = (float)sample_rate; plugin_set_sample_rate(&instance->p, instance->sample_rate); - size_t req = plugin_mem_req(&instance->p); + req = plugin_mem_req(&instance->p); if (req != 0) { instance->mem = malloc(req); if (instance->mem == NULL) { @@ -265,34 +284,34 @@ static void connect_port(LV2_Handle instance, uint32_t port, void * data_locatio plugin_instance * i = (plugin_instance *)instance; #if DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N > 0 if (port < DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N) { - i->x[port] = data_location; + i->x[port] = (const float *)data_location; return; } port -= DATA_PRODUCT_AUDIO_INPUT_CHANNELS_N; #endif #if DATA_PRODUCT_AUDIO_OUTPUT_CHANNELS_N > 0 if (port < DATA_PRODUCT_AUDIO_OUTPUT_CHANNELS_N) { - i->y[port] = data_location; + i->y[port] = (float *)data_location; return; } port -= DATA_PRODUCT_AUDIO_OUTPUT_CHANNELS_N; #endif #if DATA_PRODUCT_MIDI_INPUTS_N > 0 if (port < DATA_PRODUCT_MIDI_INPUTS_N) { - i->x_midi[port] = data_location; + i->x_midi[port] = (const LV2_Atom_Sequence *)data_location; return; } port -= DATA_PRODUCT_MIDI_INPUTS_N; #endif #if DATA_PRODUCT_MIDI_OUTPUTS_N > 0 if (port < DATA_PRODUCT_MIDI_OUTPUTS_N) { - i->y_midi[port] = data_location; + i->y_midi[port] = (LV2_Atom_Sequence *)data_location; return; } port -= DATA_PRODUCT_MIDI_OUTPUTS_N; #endif #if (DATA_PRODUCT_CONTROL_INPUTS_N + DATA_PRODUCT_CONTROL_OUTPUTS_N) > 0 - i->c[port] = data_location; + i->c[port] = (float *)data_location; #endif } @@ -306,9 +325,13 @@ static void activate(LV2_Handle instance) { # ifdef DATA_STATE_DSP_CUSTOM for (uint32_t j = 0; j < DATA_PRODUCT_CONTROL_INPUTS_N; j++) i->params_sync[j] = i->params[j]; +# ifdef __cplusplus + i->sync_lock_flag.clear(); +# else // why is this not correct? // i->sync_lock_flag = ATOMIC_FLAG_INIT; atomic_flag_clear(&i->sync_lock_flag); +# endif i->synced = 1; i->loaded = 0; # endif @@ -333,7 +356,11 @@ static void run(LV2_Handle instance, uint32_t sample_count) { #if DATA_PRODUCT_CONTROL_INPUTS_N > 0 # ifdef DATA_STATE_DSP_CUSTOM +# ifdef __cplusplus + _Bool locked = !i->sync_lock_flag.test_and_set(); +# else _Bool locked = !atomic_flag_test_and_set(&i->sync_lock_flag); +# endif if (locked) { if (!i->synced) { if (i->loaded) { @@ -373,7 +400,11 @@ static void run(LV2_Handle instance, uint32_t sample_count) { # ifdef DATA_STATE_DSP_CUSTOM if (locked) +# ifdef __cplusplus + i->sync_lock_flag.clear(); +# else atomic_flag_clear(&i->sync_lock_flag); +# endif # endif #endif @@ -467,7 +498,7 @@ static LV2_State_Status state_restore(LV2_Handle instance, LV2_State_Retrieve_Fu } size_t length; uint32_t type, xflags; // jalv 1.6.6 crashes using NULL as per spec, so we have these two - const char * data = retrieve(handle, i->uri_state_data, &length, &type, &xflags); + const char * data = (const char *)retrieve(handle, i->uri_state_data, &length, &type, &xflags); if (data == NULL) { lv2_log_error(&i->logger, "Cannot restore state since property <%s> could not be retrieved\n", DATA_LV2_URI "#state_data"); return LV2_STATE_ERR_NO_PROPERTY; @@ -561,7 +592,12 @@ static LV2UI_Handle ui_instantiate(const LV2UI_Descriptor * descriptor, const ch (void)descriptor; (void)plugin_uri; - ui_instance *instance = malloc(sizeof(ui_instance)); + // make C++ compilers happy; + char has_parent; + void *parent; + plugin_ui_callbacks cbs; + + ui_instance *instance = (ui_instance *)malloc(sizeof(ui_instance)); if (instance == NULL) goto err_instance; @@ -569,8 +605,8 @@ static LV2UI_Handle ui_instantiate(const LV2UI_Descriptor * descriptor, const ch if (instance->bundle_path == NULL) goto err_bundle_path; - char has_parent = 0; - void *parent = NULL; + has_parent = 0; + parent = NULL; # if DATA_PRODUCT_CONTROL_INPUTS_N > 0 instance->has_touch = 0; # endif @@ -587,17 +623,15 @@ static LV2UI_Handle ui_instantiate(const LV2UI_Descriptor * descriptor, const ch # endif } - plugin_ui_callbacks cbs = { - /* .handle = */ (void *)instance, - /* .format = */ "lv2", - /* .get_bindir = */ ui_get_bundle_path_cb, - /* .get_datadir = */ ui_get_bundle_path_cb, + cbs.handle = (void *)instance; + cbs.format = "lv2"; + cbs.get_bindir = ui_get_bundle_path_cb; + cbs.get_datadir = ui_get_bundle_path_cb; # if DATA_PRODUCT_CONTROL_INPUTS_N > 0 - /* .set_parameter_begin = */ ui_set_parameter_begin_cb, - /* .set_parameter = */ ui_set_parameter_cb, - /* .set_parameter_end = */ ui_set_parameter_end_cb, + cbs.set_parameter_begin = ui_set_parameter_begin_cb; + cbs.set_parameter = ui_set_parameter_cb; + cbs.set_parameter_end = ui_set_parameter_end_cb; # endif - }; # if DATA_PRODUCT_CONTROL_INPUTS_N > 0 instance->write = write_function; instance->controller = controller; diff --git a/test/plugin_ui.h b/test/plugin_ui.h index 63cc82a..417e9e9 100644 --- a/test/plugin_ui.h +++ b/test/plugin_ui.h @@ -25,8 +25,8 @@ typedef struct { void *widget; - vinci *vinci; - window *window; + vinci *ui; + window *w; int param_down; float gain; @@ -57,16 +57,16 @@ static void draw_rect(window *w, uint32_t x, uint32_t y, uint32_t width, uint32_ } static void draw_slider(plugin_ui *pui, int id, float value) { - const int w = window_get_width(pui->window); - const int h = window_get_height(pui->window); - draw_rect(pui->window, 0.1 * w, 0.15 * (id + 1) * h, 0.8 * w * value, 0.1 * h, 0x6789ab); - draw_rect(pui->window, 0.1 * w + 0.8 * w * value, 0.15 * (id + 1) * h, 0.8 * w * (1.f - value), 0.1 * h, 0x1223bc); + const int w = window_get_width(pui->w); + const int h = window_get_height(pui->w); + draw_rect(pui->w, 0.1 * w, 0.15 * (id + 1) * h, 0.8 * w * value, 0.1 * h, 0x6789ab); + draw_rect(pui->w, 0.1 * w + 0.8 * w * value, 0.15 * (id + 1) * h, 0.8 * w * (1.f - value), 0.1 * h, 0x1223bc); } static void draw_button(plugin_ui *pui, int id, char value) { - const int w = window_get_width(pui->window); - const int h = window_get_height(pui->window); - draw_rect(pui->window, 0.4 * w, 0.15 * (id + 1) * h, 0.2 * w, 0.1 * h, value ? 0x6789ab : 0x1223bc); + const int w = window_get_width(pui->w); + const int h = window_get_height(pui->w); + draw_rect(pui->w, 0.4 * w, 0.15 * (id + 1) * h, 0.2 * w, 0.1 * h, value ? 0x6789ab : 0x1223bc); } static void on_close(window *w) { @@ -191,11 +191,11 @@ static plugin_ui *plugin_ui_create(char has_parent, void *parent, plugin_ui_call wcbs.on_window_resize = on_window_resize; instance->param_down = -1; - instance->vinci = vinci_new(); - instance->window = window_new(instance->vinci, has_parent ? parent : NULL, WIDTH, HEIGHT, &wcbs); - instance->widget = window_get_handle(instance->window); - window_set_data(instance->window, (void*) instance); - window_show(instance->window); + instance->ui = vinci_new(); + instance->w = window_new(instance->ui, has_parent ? parent : NULL, WIDTH, HEIGHT, &wcbs); + instance->widget = window_get_handle(instance->w); + window_set_data(instance->w, (void*) instance); + window_show(instance->w); // just some valid values to allow drawing instance->gain = 0.f; @@ -204,20 +204,20 @@ static plugin_ui *plugin_ui_create(char has_parent, void *parent, plugin_ui_call instance->bypass = 0; instance->y_z1 = 0.f; - on_window_resize(instance->window, window_get_width(instance->window), window_get_height(instance->window)); + on_window_resize(instance->w, window_get_width(instance->w), window_get_height(instance->w)); instance->cbs = *cbs; return instance; } static void plugin_ui_free(plugin_ui *instance) { - window_free(instance->window); - vinci_destroy(instance->vinci); + window_free(instance->w); + vinci_destroy(instance->ui); free(instance); } static void plugin_ui_idle(plugin_ui *instance) { - vinci_idle(instance->vinci); + vinci_idle(instance->ui); } static void plugin_ui_set_parameter(plugin_ui *instance, size_t index, float value) { From 9310b08670b517eeb0c028e1e86ad36486e50ccc Mon Sep 17 00:00:00 2001 From: Stefano D'Angelo Date: Fri, 25 Jul 2025 08:20:00 +0200 Subject: [PATCH 8/8] necessary cleaning of single comment --- templates/lv2/src/lv2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/lv2/src/lv2.c b/templates/lv2/src/lv2.c index 48bd638..d32d10b 100644 --- a/templates/lv2/src/lv2.c +++ b/templates/lv2/src/lv2.c @@ -592,7 +592,7 @@ static LV2UI_Handle ui_instantiate(const LV2UI_Descriptor * descriptor, const ch (void)descriptor; (void)plugin_uri; - // make C++ compilers happy; + // make C++ compilers happy char has_parent; void *parent; plugin_ui_callbacks cbs;