feat: add save/load thread and WAV file I/O for clip persistence
Co-authored-by: aider (deepseek/deepseek-coder) <aider@aider.chat>
This commit is contained in:
24
cli.c
24
cli.c
@@ -1,4 +1,5 @@
|
||||
#include "cli.h"
|
||||
#include "wav_io.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
@@ -56,6 +57,8 @@ int cli_process_line(Engine *engine, const char *line) {
|
||||
printf(" toggle - Toggle play/pause\n");
|
||||
printf(" clock internal|midi - Set clock source\n");
|
||||
printf(" bpm <value> - Set BPM (1.0-999.0)\n");
|
||||
printf(" load <clip> <file> - Load WAV file into clip\n");
|
||||
printf(" save <clip> - Save clip to samples/clip_<N>.wav\n");
|
||||
printf(" help - Show this help\n");
|
||||
printf(" quit - Exit CLI\n");
|
||||
return 1;
|
||||
@@ -157,6 +160,27 @@ int cli_process_line(Engine *engine, const char *line) {
|
||||
printf("Unknown clock source: %s\n", source_str);
|
||||
}
|
||||
}
|
||||
else if (strcasecmp(token, "load") == 0) {
|
||||
char *clip_str = strtok(NULL, " \t");
|
||||
char *filename = strtok(NULL, " \t");
|
||||
if (!clip_str || !filename) {
|
||||
printf("Usage: load <clip_index> <filename>\n");
|
||||
return 1;
|
||||
}
|
||||
int clip_idx = atoi(clip_str);
|
||||
save_load_queue_push(&engine->save_load_queue, REQ_LOAD_CLIP, clip_idx, filename);
|
||||
printf("Loading %s into clip %d...\n", filename, clip_idx);
|
||||
}
|
||||
else if (strcasecmp(token, "save") == 0) {
|
||||
char *clip_str = strtok(NULL, " \t");
|
||||
if (!clip_str) {
|
||||
printf("Usage: save <clip_index>\n");
|
||||
return 1;
|
||||
}
|
||||
int clip_idx = atoi(clip_str);
|
||||
save_load_queue_push(&engine->save_load_queue, REQ_SAVE_CLIP, clip_idx, "");
|
||||
printf("Saving clip %d...\n", clip_idx);
|
||||
}
|
||||
else if (strcasecmp(token, "bpm") == 0) {
|
||||
char *bpm_str = strtok(NULL, " \t");
|
||||
if (!bpm_str) {
|
||||
|
||||
Reference in New Issue
Block a user