feat: add project save/load with .wheel files and auto-save thread
Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
17
main.c
17
main.c
@@ -9,6 +9,7 @@
|
||||
#include "gui.h"
|
||||
#include "dispatcher.h"
|
||||
#include "carla.h"
|
||||
#include "fs.h"
|
||||
|
||||
static Engine engine;
|
||||
static volatile int keep_running = 1;
|
||||
@@ -95,6 +96,9 @@ int main(int argc, char *argv[]) {
|
||||
// Initialize dispatcher
|
||||
dispatch = dispatcher_init(&initial_state);
|
||||
|
||||
// Initialize filesystem module (auto-save thread)
|
||||
fs_init(&initial_state);
|
||||
|
||||
// Initialize engine
|
||||
if (engine_init(&engine, client_name, dispatch) != 0) {
|
||||
fprintf(stderr, "Failed to initialize engine\n");
|
||||
@@ -122,6 +126,18 @@ int main(int argc, char *argv[]) {
|
||||
printf("Sample rate: %u Hz\n", engine.sample_rate);
|
||||
printf("Press Ctrl+C to stop\n\n");
|
||||
|
||||
// Load project file if specified
|
||||
if (optind < argc) {
|
||||
const char *wheel_file = argv[optind];
|
||||
size_t len = strlen(wheel_file);
|
||||
if (len > 6 && strcmp(wheel_file + len - 6, ".wheel") == 0) {
|
||||
Action action = { .type = ACTION_LOAD_PROJECT };
|
||||
strncpy(action.data.load_project.filename, wheel_file, sizeof(action.data.load_project.filename) - 1);
|
||||
action.data.load_project.filename[sizeof(action.data.load_project.filename) - 1] = '\0';
|
||||
dispatch(action);
|
||||
}
|
||||
}
|
||||
|
||||
// Run selected frontend
|
||||
switch (frontend) {
|
||||
case FRONTEND_TUI:
|
||||
@@ -141,6 +157,7 @@ int main(int argc, char *argv[]) {
|
||||
printf("\nShutting down...\n");
|
||||
engine_stop(&engine);
|
||||
engine_cleanup(&engine);
|
||||
fs_cleanup();
|
||||
dispatcher_stop();
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user