feat: add logging system, orchestrator, and documentation

This commit is contained in:
Loic Coenen
2026-05-19 08:26:36 +00:00
parent f776b8a361
commit e79c2ac116
27 changed files with 612 additions and 13 deletions

View File

@@ -8,6 +8,7 @@ CARLA_OBJ = src/carla_host.o
PLUGINS_OBJ = src/plugins.o
CLIENT_CMD_OBJ = src/client_cmd.o
SCRIPT_OBJ = src/script.o
LOG_OBJ = src/log.o
# Test binaries
TEST_PLUGINS_BIN = test_plugins
@@ -18,7 +19,7 @@ TEST_INTEGRATION_BIN = test_integration
all: looper-client test_status_parse
looper-client: src/main.c src/tui.c $(PLUGINS_OBJ) $(CARLA_OBJ) $(CLIENT_CMD_OBJ) $(SCRIPT_OBJ)
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)
@@ -53,6 +54,9 @@ $(TEST_SCRIPT_OBJ): tests/test_script.c src/script.h
$(TEST_SCRIPT_BIN): $(TEST_SCRIPT_OBJ) $(SCRIPT_OBJ)
$(CC) $(CFLAGS) -o $@ $^
$(LOG_OBJ): src/log.c
$(CC) $(CFLAGS) -c -o $@ $<
# --- Plugin tests ---
TEST_PLUGINS_OBJ = tests/test_plugins.o

1
client/src/log.c Normal file
View File

@@ -0,0 +1 @@
#include "../engine/src/log.c"

View File

@@ -1,10 +1,13 @@
#include "tui.h"
#include "script.h"
#include "log.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char *argv[]) {
log_init();
const char *script_path = NULL;
if (argc > 2 && strcmp(argv[1], "-s") == 0) {
@@ -20,11 +23,12 @@ int main(int argc, char *argv[]) {
}
if (script_path && script_load(script_path) != 0) {
fprintf(stderr, "Warning: could not load script '%s'\n", script_path);
log_msg("Warning: could not load script '%s'", script_path);
}
tui_init();
tui_run();
tui_cleanup();
log_close();
return 0;
}

View File

@@ -45,6 +45,13 @@ int script_load(const char *path) {
return 0;
}
void script_cleanup(void) {
for (int i = 0; i < MAX_NOTES; i++) {
free(note_actions[i]);
note_actions[i] = NULL;
}
}
void script_handle_note(int note) {
if (note < 0 || note >= MAX_NOTES) return;
char *macro = note_actions[note];

View File

@@ -3,5 +3,6 @@
int script_load(const char *path);
void script_handle_note(int note);
void script_cleanup(void);
#endif

View File

@@ -398,6 +398,8 @@ void tui_run(void) {
void tui_cleanup(void) {
if (yank_buffer.clip_indices) free(yank_buffer.clip_indices);
/* free script note allocations */
script_cleanup();
/* delete FIFOs */
unlink(STATUS_FIFO);
unlink(CMD_FIFO);