fix: move CarlaHost to Engine struct and fix TUI plugin dialog access

Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
Loic Coenen
2026-05-03 10:30:36 +00:00
parent 8c9804d2ef
commit adcc5e14cf
5 changed files with 16 additions and 13 deletions

9
gui.c
View File

@@ -46,7 +46,7 @@ static int loop_length = 8; /* beats */
static int current_beat = 0;
/* Carla host and plugin URI input */
static CarlaHost carla_host;
/* CarlaHost is now stored in Engine struct */
static char plugin_uri_input[256];
static int plugin_uri_input_len = 0;
static int selected_channel = 0;
@@ -136,7 +136,7 @@ static void gui_update(void)
mu_layout_row(ctx, 1, (int[]) { -1 }, 0);
if (mu_button(ctx, "Add Plugin")) {
if (plugin_uri_input_len > 0) {
carla_add_plugin(&carla_host, selected_channel, plugin_uri_input, PLUGIN_TYPE_INTERNAL);
carla_add_plugin(&g_engine->carla_host, selected_channel, plugin_uri_input, PLUGIN_TYPE_INTERNAL);
plugin_uri_input_len = 0;
plugin_uri_input[0] = '\0';
}
@@ -155,8 +155,7 @@ int gui_main(Engine *engine)
{
g_engine = engine;
/* Initialize Carla host */
carla_init(&carla_host, engine->client);
/* Carla host is now initialized in engine_init */
/* initialise microui */
ctx = malloc(sizeof(mu_Context));
@@ -259,7 +258,7 @@ int gui_main(Engine *engine)
}
/* cleanup */
carla_cleanup(&carla_host);
carla_cleanup(&g_engine->carla_host);
endwin();
free(ctx);
return 0;