#include "xtc/xtc_plugin.h" #include "xtc/xtc_tempo.h" #include #include #include #include static void tap_tests(void) { xtc_tap_tempo s={0},before;unsigned int tempo=999; assert(xtc_tap_tempo_push(&s,0,&tempo)==XTC_ERR_NOT_FOUND && tempo==999); assert(xtc_tap_tempo_push(&s,.5,&tempo)==XTC_OK && tempo==120000); before=s;assert(xtc_tap_tempo_push(&s,.55,&tempo)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&s,&before,sizeof(s)) && tempo==120000); assert(xtc_tap_tempo_push(&s,NAN,&tempo)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&s,&before,sizeof(s))); assert(xtc_tap_tempo_push(&s,.4,&tempo)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&s,&before,sizeof(s))); assert(xtc_tap_tempo_push(&s,1,&tempo)==XTC_OK && xtc_tap_tempo_push(&s,1.5,&tempo)==XTC_OK && xtc_tap_tempo_push(&s,2,&tempo)==XTC_OK); assert(xtc_tap_tempo_push(&s,2.25,&tempo)==XTC_OK && tempo==137143); assert(xtc_tap_tempo_push(&s,10,&tempo)==XTC_ERR_NOT_FOUND && tempo==137143 && !s.count); assert(xtc_tap_tempo_push(&s,10.25,&tempo)==XTC_OK && tempo==240000); xtc_tap_tempo_reset(&s);assert(!s.started && !s.count); } int main(void) { tap_tests(); xtc_track_chain c={0},out={0}; c.output_gain=.8f;c.count=1;c.slots[0].enabled=1;c.slots[0].wet=.4f; assert(xtc_plugin_probe_format(XTC_PLUGIN_BUILTIN,XTC_BUILTIN_PATH,2,48000,&c.slots[0].plugin)==XTC_OK); assert(xtc_track_chain_duplicate(&c,0,&out)==XTC_OK && out.count==2 && out.output_gain==.8f); assert(!memcmp(out.slots,out.slots+1,sizeof(out.slots[0]))); out.slots[1].plugin.values[0]=10;assert(c.slots[0].plugin.values[0]!=10 && out.slots[0].plugin.values[0]!=10); assert(xtc_track_chain_duplicate(&out,1,&out)==XTC_OK && out.count==3 && out.slots[2].plugin.values[0]==10); c=out;assert(xtc_track_chain_duplicate(&out,3,&out)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&c,&out,sizeof(c))); for(size_t i=3;i0); xtc_plan_destroy(plan);xtc_graph_destroy(g); } out=c;assert(!xtc_track_chain_template_name(3) && xtc_track_chain_template(3,120000,&c)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&out,&c,sizeof(c))); assert(xtc_track_chain_template(1,120000,&c)==XTC_OK); assert(xtc_track_chain_bulk(&c,XTC_CHAIN_BYPASS_ALL,&c)==XTC_OK && !c.slots[0].enabled && !c.slots[1].enabled && c.output_gain==.8f); assert(xtc_track_chain_bulk(&c,XTC_CHAIN_ENABLE_ALL,&c)==XTC_OK && c.slots[0].enabled && c.slots[1].enabled); out=c;assert(xtc_track_chain_bulk(&c,(xtc_chain_action)99,&c)==XTC_ERR_INVALID_ARGUMENT && !memcmp(&c,&out,sizeof(c))); assert(xtc_track_chain_bulk(&c,XTC_CHAIN_CLEAR,&c)==XTC_OK && c.count==0 && c.output_gain==.8f && !c.slots[0].plugin.path[0]); puts("Creative editing core checks passed.");return 0; }