1
0
Fork 0
forked from hanez/xtc

Phase 26: add common parameter targets, step automation and MIDI control mapping

This commit is contained in:
Johannes Findeisen 2026-10-27 16:37:59 +01:00
commit 901a536f10
38 changed files with 740 additions and 67 deletions

View file

@ -1,5 +1,6 @@
#define _POSIX_C_SOURCE 200809L
#include "xtc/xtc_plugin.h"
#include "xtc/xtc_control.h"
#include "xtc/xtc_project.h"
#include "xtc/xtc_realtime.h"
#include <assert.h>
@ -79,6 +80,12 @@ static void graph_roundtrip(const xtc_plugin_spec *spec)
assert(xtc_project_create(&loaded) == XTC_OK);
assert(xtc_project_load(loaded,path) == XTC_OK);
assert(xtc_graph_compile(xtc_project_graph(loaded),48000,31,&again) == XTC_ERR_NOT_FOUND && !again);
{
xtc_parameter_key key = {XTC_PARAMETER_PLUGIN,plugin,copy.control_count ? copy.ports[0] : 0};
xtc_parameter_state state = {0}; state.value = .75f;
assert(xtc_project_parameter(loaded,key,48000,&state) == XTC_ERR_NOT_FOUND && state.value == .75f);
assert(xtc_project_automate(loaded,key,48000,0,1,1,0) == XTC_ERR_NOT_FOUND);
}
assert(xtc_project_save(loaded,path) == XTC_OK);
xtc_graph_destroy(g); xtc_project_destroy(project); xtc_project_destroy(loaded);
xtc_plan_destroy(p); unlink(path);
@ -167,6 +174,25 @@ int main(int argc, char **argv)
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;
}
{
xtc_project *project = NULL; xtc_graph *g = NULL;
xtc_parameter_key key;
xtc_parameter_state state;
xtc_plugin_spec copy;
size_t id;
assert(xtc_project_create(&project) == XTC_OK && xtc_graph_create(8,&g) == XTC_OK);
assert(xtc_graph_add_plugin(g,&s,&id) == XTC_OK && xtc_project_set_graph(project,g) == XTC_OK);
key = (xtc_parameter_key){XTC_PARAMETER_PLUGIN,id,s.ports[0]};
assert(xtc_project_parameter(project,key,48000,&state) == XTC_OK && state.automated && state.info.id == s.ports[0]);
assert(xtc_project_set_parameter(project,key,48000,.75f) == XTC_OK);
assert(xtc_project_automate(project,key,48000,3,1,1,0) == XTC_OK);
assert(xtc_project_automate(project,key,48000,3,99,NAN,1) == XTC_OK); // Removal ignores mode/value.
assert(xtc_project_set_parameter(project,key,48000,3) == XTC_ERR_INVALID_ARGUMENT);
assert(xtc_graph_get_plugin(xtc_project_graph(project),id,&copy) == XTC_OK && copy.values[0] == .75f && copy.point_count == 2);
key.parameter = 63;
assert(xtc_project_automate(project,key,48000,0,1,0,0) == XTC_ERR_NOT_FOUND);
xtc_graph_destroy(g); xtc_project_destroy(project);
}
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);