feat(inserts): duplicate effect slots with independent state (phase 91)

This commit is contained in:
Johannes Findeisen 2026-11-06 02:03:36 +01:00
commit 062b33f55f
8 changed files with 69 additions and 5 deletions

11
src/project/chain_tools.c Normal file
View file

@ -0,0 +1,11 @@
#include "xtc/xtc_plugin.h"
/* Metadata transforms never load modules; aliases are safe and errors atomic. */
xtc_result xtc_track_chain_duplicate(const xtc_track_chain *chain,size_t index,xtc_track_chain *out)
{
xtc_track_chain copy;size_t i;
if(!out || xtc_track_chain_validate(chain)!=XTC_OK || index>=chain->count)return XTC_ERR_INVALID_ARGUMENT;
if(chain->count==XTC_TRACK_INSERTS)return XTC_ERR_CAPACITY;
copy=*chain;
for(i=copy.count;i>index+1;--i)copy.slots[i]=copy.slots[i-1];
copy.slots[index+1]=copy.slots[index];++copy.count;*out=copy;return XTC_OK;
}