feat: compare mixer A/B snapshots with undo and qualify modern editing workflows

This commit is contained in:
Johannes Findeisen 2026-11-06 00:25:23 +01:00
commit 1b668068de
14 changed files with 261 additions and 34 deletions

View file

@ -178,3 +178,27 @@ xtc_result xtc_project_transform_midi(xtc_project *p,const uint64_t *ids,size_t
if(r==XTC_OK)publish(p,copy);
xtc_project_destroy(copy);return r;
}
struct xtc_mix_snapshot {size_t count;xtc_track_info tracks[XTC_PROJECT_MAX_TRACKS];};
void xtc_mix_snapshot_destroy(xtc_mix_snapshot *snapshot){free(snapshot);}
xtc_result xtc_mix_snapshot_create(const xtc_project *p,xtc_mix_snapshot **out)
{
xtc_mix_snapshot *snapshot;
if(!p || !out)return XTC_ERR_INVALID_ARGUMENT;
snapshot=calloc(1,sizeof(*snapshot));if(!snapshot)return XTC_ERR_OUT_OF_MEMORY;
snapshot->count=p->track_count;memcpy(snapshot->tracks,p->tracks,p->track_count*sizeof(*p->tracks));
*out=snapshot;return XTC_OK;
}
xtc_result xtc_mix_snapshot_recall(const xtc_mix_snapshot *snapshot,xtc_project *p)
{
xtc_project *copy=NULL;size_t i;xtc_result r;
if(!snapshot || !p)return XTC_ERR_INVALID_ARGUMENT;
if(snapshot->count!=p->track_count)return XTC_ERR_INVALID_STATE;
r=xtc_project_clone(p,&copy);
for(i=0;r==XTC_OK && i<snapshot->count;++i) {
const xtc_track_info *track=snapshot->tracks+i;
r=xtc_project_set_mix(copy,track->id,track->gain,track->pan,track->mute,track->solo);
}
if(r==XTC_OK)publish(p,copy);
xtc_project_destroy(copy);return r;
}