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

@ -466,6 +466,7 @@ xtc_result xtc_project_set_tempo(xtc_project *project, unsigned int tempo)
if (project == NULL || tempo < 20000U || tempo > 300000U)
return XTC_ERR_INVALID_ARGUMENT;
project->tempo = tempo;
{size_t i;for(i=0;i<project->track_count;++i)if(project->instruments[i].instrument)project->instruments[i].tempo=tempo;}
{ size_t i; for (i = 0; i < project->graph->node_count; ++i)
if (project->graph->nodes[i].type == XTC_NODE_PLUGIN) project->graph->nodes[i].plugin.tempo = tempo; }
return XTC_OK;
@ -745,7 +746,7 @@ xtc_result xtc_project_set_instrument(xtc_project *p, uint64_t track, const xtc_
r = xtc_project_clone(p,&candidate);
if (r == XTC_OK && spec) r = xtc_project_ensure_midi_route(candidate);
if (r == XTC_OK) {
if (spec) { candidate->instruments[i] = *spec; candidate->live_instrument = track; }
if (spec) { candidate->instruments[i] = *spec; candidate->instruments[i].tempo=p->tempo; candidate->live_instrument = track; }
else { memset(candidate->instruments+i,0,sizeof(*candidate->instruments));
if (candidate->live_instrument == track) candidate->live_instrument = UINT64_MAX; }
{ xtc_graph *old = p->graph; *p = *candidate; candidate->graph = old; }