feat: add engine alive indicator, debug mode, and orchestrator retry logic
This commit is contained in:
committed by
Loic Coenen (aider)
parent
e79c2ac116
commit
f2993eac80
@@ -1,5 +1,5 @@
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -Wpedantic -std=c11 -Isrc
|
||||
CFLAGS = -Wall -Wextra -Wpedantic -std=c11 -Isrc -I../engine/src
|
||||
CARLA_INC = -I/usr/include/carla -I/usr/include/carla/includes
|
||||
CARLA_LIB = -L/usr/lib/carla -Wl,-rpath,/usr/lib/carla -lcarla_standalone2
|
||||
|
||||
@@ -22,8 +22,8 @@ all: looper-client test_status_parse
|
||||
looper-client: src/main.c src/tui.c $(PLUGINS_OBJ) $(CARLA_OBJ) $(CLIENT_CMD_OBJ) $(SCRIPT_OBJ) $(LOG_OBJ)
|
||||
$(CC) $(CFLAGS) $(CARLA_INC) -o $@ $^ $(CARLA_LIB) -ljack -lncurses
|
||||
|
||||
test_status_parse: tests/test_status_parse.c $(PLUGINS_OBJ) $(CARLA_OBJ) $(CLIENT_CMD_OBJ)
|
||||
$(CC) $(CFLAGS) $(CARLA_INC) -o test_status_parse tests/test_status_parse.c src/tui.c $(PLUGINS_OBJ) $(CARLA_OBJ) $(CLIENT_CMD_OBJ) $(CARLA_LIB) -ljack -lncurses
|
||||
test_status_parse: tests/test_status_parse.c $(PLUGINS_OBJ) $(CARLA_OBJ) $(CLIENT_CMD_OBJ) $(SCRIPT_OBJ)
|
||||
$(CC) $(CFLAGS) $(CARLA_INC) -o test_status_parse tests/test_status_parse.c src/tui.c $(PLUGINS_OBJ) $(CARLA_OBJ) $(CLIENT_CMD_OBJ) $(SCRIPT_OBJ) $(CARLA_LIB) -ljack -lncurses
|
||||
|
||||
# --- Plugin stubs (now real) ---
|
||||
$(PLUGINS_OBJ): src/plugins.c src/plugins.h
|
||||
|
||||
@@ -1 +1 @@
|
||||
#include "../engine/src/log.c"
|
||||
#include "../../engine/src/log.c"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <ctype.h>
|
||||
@@ -15,8 +16,15 @@
|
||||
#include "script.h"
|
||||
#include <CarlaHost.h>
|
||||
|
||||
/* ---------- engine alive indicator ---------- */
|
||||
static bool engine_running = false;
|
||||
static bool debug_mode = false;
|
||||
|
||||
/* ---------- FIFO command helper ---------- */
|
||||
int send_command(const char *cmd) {
|
||||
if (debug_mode) {
|
||||
fprintf(stderr, "DEBUG: send_command(%s)\n", cmd);
|
||||
}
|
||||
const char *fifo_path = getenv("LOOPER_CMD_FIFO");
|
||||
if (!fifo_path) fifo_path = "/tmp/looper_cmd";
|
||||
int fd = open(fifo_path, O_WRONLY | O_NONBLOCK);
|
||||
@@ -162,7 +170,7 @@ static void draw_grid(void) {
|
||||
}
|
||||
clear();
|
||||
attron(A_BOLD);
|
||||
mvprintw(0,0,"JACK Looper - Client (FIFO only)");
|
||||
mvprintw(0,0,"JACK Looper - Client (FIFO only) %s", engine_running ? "[online]" : "[offline]");
|
||||
attroff(A_BOLD);
|
||||
for (int r=0; r<GRID_ROWS; r++)
|
||||
for (int c=0; c<GRID_COLS; c++)
|
||||
@@ -181,6 +189,7 @@ static void draw_grid(void) {
|
||||
void tui_init(void) {
|
||||
initscr();
|
||||
cbreak(); noecho(); keypad(stdscr, TRUE); curs_set(0);
|
||||
debug_mode = (getenv("LOOPER_DEBUG") != NULL);
|
||||
if (!has_colors()) { endwin(); fprintf(stderr,"No colors\n"); exit(1); }
|
||||
start_color();
|
||||
init_pair(COLOR_EMPTY, COLOR_WHITE, COLOR_BLACK);
|
||||
@@ -234,6 +243,9 @@ void tui_run(void) {
|
||||
close(fd);
|
||||
}
|
||||
|
||||
/* Check if engine is alive by testing existence of status FIFO */
|
||||
engine_running = (access(STATUS_FIFO, F_OK) == 0);
|
||||
|
||||
/* read any available note events (for script macros) */
|
||||
int nfd = open(NOTES_FIFO, O_RDONLY | O_NONBLOCK);
|
||||
if (nfd >= 0) {
|
||||
|
||||
Reference in New Issue
Block a user