feat: add editable internal instruments, automation and versioned presets

This commit is contained in:
Johannes Findeisen 2026-11-05 23:47:54 +01:00
commit 159fa939a1
21 changed files with 295 additions and 52 deletions

View file

@ -45,7 +45,8 @@ typedef enum {
XTC_MIDI_NOTE_ON = 1,
XTC_MIDI_NOTE_OFF,
XTC_MIDI_ALL_OFF,
XTC_MIDI_CONTROL /* pitch = CC number, velocity = 0..127 value */
XTC_MIDI_CONTROL, /* pitch = CC number, velocity = 0..127 value */
XTC_MIDI_BEND /* pitch = LSB, velocity = MSB of 14-bit bend; center 8192 */
} xtc_midi_type;
typedef struct {
@ -127,7 +128,7 @@ xtc_result xtc_project_remove_note(xtc_project *project, uint64_t id);
/* Complete 3-byte note on/off and CC0..127. Velocity-zero on -> off.
* CC120/123 decode to ALL_OFF; other CCs are interpreted by prepared bindings.
* Unsupported messages return UNSUPPORTED; malformed supported messages INVALID.
* Output unchanged on error. No running-status/SysEx/program/bend support. */
* Output unchanged on error. No running-status/SysEx/program support. */
/**
* @brief Decodes a complete note, controller or all-notes-off MIDI message into a block event.
*

View file

@ -73,6 +73,12 @@ void xtc_plugin_destroy(xtc_plugin *plugin); /* control, after quiescence */
* must obey realtime rules. No MIDI; max one mono input and one mono output.
* Transport reset retains LADSPA delay history (no realtime reset contract). */
/* Instruments: sorted bounded MIDI, mono output, single audio owner. */
/* Absolute sample position supports instrument parameter automation and seek. */
xtc_result xtc_plugin_process_midi_at(xtc_plugin *plugin, const xtc_midi_event *events, size_t count, float *output, size_t frames, uint64_t position);
/* Control-thread preset files use a versioned single-instrument project container.
* Load is transactional, validates metadata and never loads executable modules. */
xtc_result xtc_plugin_preset_save(const xtc_plugin_spec *spec, const char *path);
xtc_result xtc_plugin_preset_load(const char *path, xtc_plugin_spec *out);
xtc_result xtc_plugin_process_midi(xtc_plugin *plugin, const xtc_midi_event *events, size_t count, float *output, size_t frames);
/* Metadata-only track assignment. NULL restores built-in sine. Assignment ensures
* an instrument-source graph route transactionally. Missing modules stay saved. */

View file

@ -7,7 +7,7 @@
extern "C" {
#endif
#define XTC_PROJECT_FORMAT_VERSION 13U
#define XTC_PROJECT_FORMAT_VERSION 14U
#define XTC_PROJECT_MAX_TRACKS 64U
#define XTC_PROJECT_MAX_CLIPS 1024U
#define XTC_PROJECT_NAME_BYTES 64U