Phase 35: add persistent preferences and sequencer loop playback

This commit is contained in:
Johannes Findeisen 2026-10-28 10:37:01 +01:00
commit 47b7d38a66
21 changed files with 852 additions and 108 deletions

View file

@ -106,6 +106,10 @@ xtc_result xtc_backend_request_stop(xtc_backend *backend);
* @return XTC_OK on success, or an error code describing the failure.
*/
xtc_result xtc_backend_seek(xtc_backend *backend, uint64_t sample);
/* Stopped-only loop [start,end) in samples. Enabled loops require >=64 samples
* and cannot be combined with recording. Callback splits at exact boundaries;
* live MIDI offsets remain relative to the JACK block. */
xtc_result xtc_backend_set_loop(xtc_backend *backend, uint64_t start, uint64_t end, int enabled);
/* Copies graph. While running, capacity means pending slot busy.
* While stopped, transactionally replaces all retained plans (counters/revisions
* restart); failed compilation leaves the previous engine intact. */

View file

@ -0,0 +1,37 @@
#ifndef XTC_SETTINGS_H
#define XTC_SETTINGS_H
#include "xtc.h"
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Control-thread application preferences; not project data or audio state. */
typedef struct {
char client_name[64], clap_paths[2048], vst2_paths[2048], vst3_paths[2048], ladspa_paths[2048];
int64_t max_frames, channels, transition_ms, offline_rate, recording_seconds;
int64_t width, height, piano_width, piano_height, refresh_ms;
int64_t sequencer_snap, piano_snap, sequencer_zoom;
int64_t clip_ticks, note_ticks, note_velocity, note_channel, filter_channel, filter_low, filter_high;
int64_t tempo, volume_cc, pan_cc, sustain_cc;
int64_t loop_start, loop_end, loop_enabled;
} xtc_settings;
typedef struct {
const char *section, *key, *label;
size_t offset, capacity; /* capacity > 0 means string; otherwise int64_t. */
int64_t minimum, maximum;
} xtc_setting_info;
const xtc_setting_info *xtc_settings_schema(size_t *count);
void xtc_settings_defaults(xtc_settings *settings);
xtc_result xtc_settings_validate(const xtc_settings *settings);
xtc_result xtc_settings_get(const xtc_settings *settings, size_t index, char *out, size_t size);
xtc_result xtc_settings_set(xtc_settings *settings, size_t index, const char *value);
xtc_result xtc_settings_path(char *out, size_t size);
/* Strict bounded INI. Missing file returns NOT_FOUND; failure retains destination.
* Save validates then writes a 0600 temporary, fsyncs and atomically renames it. */
xtc_result xtc_settings_load(xtc_settings *settings, const char *path);
xtc_result xtc_settings_save(const xtc_settings *settings, const char *path);
#ifdef __cplusplus
}
#endif
#endif