Phase 16: persist sample-timed effect automation and add expressive MIDI controls

This commit is contained in:
Johannes Findeisen 2026-10-27 06:25:30 +01:00
commit 7fac0a4f6a
23 changed files with 374 additions and 39 deletions

View file

@ -476,10 +476,15 @@ int main(int argc, char **argv)
const xtc_project *before = sequence->project();
CHECK(window.add_plugin("/absent/plugin.so",0) == XTC_ERR_NOT_FOUND && sequence->project() == before);
CHECK(window.add_plugin(module,2) == XTC_ERR_UNSUPPORTED && sequence->project() == before);
xtc_plugin_point point{960,spec.ports[0],0,.25f};
CHECK(window.set_plugin_automation(id,point) == XTC_OK);
CHECK(window.set_plugin_automation(id,point,true) == XTC_OK);
CHECK(window.undo(false) == XTC_OK);
CHECK(window.save_project("/tmp/xtc-gui-plugin-test.xtc") == XTC_OK);
CHECK(window.new_project() == XTC_OK);
CHECK(window.open_project("/tmp/xtc-gui-plugin-test.xtc") == XTC_OK);
CHECK(xtc_graph_get_plugin(xtc_project_graph(sequence->project()),id,&spec) == XTC_OK && spec.values[0] == .5f);
CHECK(spec.point_count == 1 && spec.points[0].tick == 960 && spec.points[0].value == .25f);
xtc_project *missing = nullptr; xtc_graph *graph = nullptr; size_t absent;
CHECK(xtc_project_create(&missing) == XTC_OK);
CHECK(xtc_graph_create(8,&graph) == XTC_OK);

View file

@ -133,6 +133,41 @@ int main(int argc, char **argv)
for (i = 0; i < 17; ++i) assert(data[i] == 1);
xtc_plugin_destroy(p); p = NULL;
graph_roundtrip(&s);
s.point_count = 2;
s.points[0] = (xtc_plugin_point){0,s.ports[0],0,.5f};
s.points[1] = (xtc_plugin_point){1,s.ports[0],0,2};
graph_roundtrip(&s);
{
xtc_graph *g = NULL; xtc_realtime *rt = NULL; size_t id;
float in[1] = {1}, out[1];
assert(xtc_graph_create(8,&g) == XTC_OK && xtc_graph_add_plugin(g,&s,&id) == XTC_OK);
assert(xtc_realtime_create(48000,31,&rt) == XTC_OK);
assert(xtc_realtime_position(rt,25) == XTC_OK && xtc_realtime_submit(rt,g) == XTC_OK);
audio = 1; assert(xtc_realtime_process(rt,in,out,1) == XTC_OK && out[0] == 2); audio = 0;
xtc_realtime_collect(rt);
assert(xtc_realtime_submit(rt,g) == XTC_OK);
audio = 1; assert(xtc_realtime_process(rt,in,out,1) == XTC_OK && out[0] == 2); audio = 0;
xtc_realtime_collect(rt);
xtc_realtime_destroy(rt); xtc_graph_destroy(g);
}
{
float whole[31], split[31], in[31]; xtc_plugin *other = NULL;
for (i = 0; i < 31; ++i) in[i] = 1;
assert(xtc_plugin_create(&s,48000,31,&p) == XTC_OK);
assert(xtc_plugin_create(&s,48000,31,&other) == XTC_OK);
audio = 1;
assert(xtc_plugin_process_at(p,in,whole,31,0) == XTC_OK);
assert(xtc_plugin_process_at(other,in,split,7,0) == XTC_OK);
assert(xtc_plugin_process_at(other,in+7,split+7,24,7) == XTC_OK);
audio = 0;
for (i = 0; i < 31; ++i) {
assert(whole[i] == split[i]);
assert(fabsf(whole[i]-(i < 25 ? .5f+1.5f*(float)i/25 : 2)) < .000001f);
}
assert(xtc_plugin_process_at(other,in,split,1,25) == XTC_OK && split[0] == 2);
xtc_plugin_destroy(p); xtc_plugin_destroy(other); p = NULL;
}
s.point_count = 0;
s.values[0] = 3; assert(xtc_plugin_create(&s,48000,17,&p) == XTC_ERR_UNSUPPORTED && !p);
assert(xtc_plugin_probe(argv[1],1,48000,&s) == XTC_OK && !s.inputs);
graph_roundtrip(&s);