Phase 25: improve LADSPA discovery, parameter editing and plugin lifecycle
This commit is contained in:
parent
2fd7724065
commit
7bff7b535d
18 changed files with 591 additions and 42 deletions
|
|
@ -174,7 +174,58 @@ int main(int argc, char **argv)
|
|||
assert(xtc_plugin_probe(argv[1],2,48000,&s) == XTC_ERR_UNSUPPORTED);
|
||||
assert(xtc_plugin_probe(argv[1],3,48000,&s) == XTC_OK);
|
||||
assert(xtc_plugin_create(&s,48000,17,&p) == XTC_ERR_INVALID_STATE && !p);
|
||||
assert(xtc_plugin_probe(argv[1],4,48000,&s) == XTC_ERR_NOT_FOUND);
|
||||
{
|
||||
xtc_plugin_details details;
|
||||
xtc_plugin_spec saved;
|
||||
assert(xtc_plugin_probe(argv[1],0,48000,&s) == XTC_OK);
|
||||
assert(xtc_plugin_describe(&s,48000,&details) == XTC_OK);
|
||||
assert(!strcmp(details.name,"Test gain") && !strcmp(details.maker,"xtc tests") &&
|
||||
!strcmp(details.copyright,"MIT") && !details.parameters[0].unit[0]);
|
||||
assert(details.parameters[0].minimum == 0 && details.parameters[0].maximum == 2);
|
||||
assert(details.flags[0] == (XTC_PLUGIN_BOUNDED_BELOW|XTC_PLUGIN_BOUNDED_ABOVE));
|
||||
s.values[0] = .25f;
|
||||
s.point_count = 1; s.points[0] = (xtc_plugin_point){0,s.ports[0],0,.5f};
|
||||
saved = s;
|
||||
assert(xtc_plugin_reset(&s,48000,63) == XTC_ERR_NOT_FOUND && !memcmp(&s,&saved,sizeof(s)));
|
||||
assert(xtc_plugin_reset(&s,48000,s.ports[0]) == XTC_OK && s.values[0] == 1 && !s.point_count);
|
||||
assert(xtc_plugin_probe(argv[1],4,48000,&s) == XTC_OK && s.values[0] == 2);
|
||||
assert(xtc_plugin_describe(&s,48000,&details) == XTC_OK && (details.flags[0] & XTC_PLUGIN_INTEGER));
|
||||
s.values[0] = .5f; assert(xtc_plugin_create(&s,48000,17,&p) == XTC_ERR_UNSUPPORTED && !p);
|
||||
assert(xtc_plugin_reset(&s,48000,UINT32_MAX) == XTC_OK && s.values[0] == 2);
|
||||
assert(xtc_plugin_probe(argv[1],5,48000,&s) == XTC_OK && s.values[0] == 1);
|
||||
assert(xtc_plugin_describe(&s,48000,&details) == XTC_OK && (details.flags[0] & XTC_PLUGIN_TOGGLED));
|
||||
s.values[0] = .5f; assert(xtc_plugin_create(&s,48000,17,&p) == XTC_ERR_UNSUPPORTED && !p);
|
||||
assert(xtc_plugin_probe(argv[1],6,48000,&s) == XTC_OK);
|
||||
assert(xtc_plugin_describe(&s,48000,&details) == XTC_OK &&
|
||||
(details.flags[0] & XTC_PLUGIN_SAMPLE_RATE) && (details.flags[0] & XTC_PLUGIN_LOGARITHMIC));
|
||||
assert(fabsf(details.parameters[0].minimum-48) < .001f && fabsf(details.parameters[0].maximum-4800) < .01f);
|
||||
assert(xtc_plugin_probe(argv[1],7,48000,&s) == XTC_ERR_UNSUPPORTED);
|
||||
assert(xtc_plugin_probe(argv[1],9,48000,&s) == XTC_ERR_NOT_FOUND);
|
||||
// Noncommutative effects demonstrate that wires define DSP order,
|
||||
// independent of node creation order; persisted graphs retain it.
|
||||
{
|
||||
xtc_graph *g = NULL; xtc_plan *plan = NULL;
|
||||
xtc_plugin_spec gain, offset; size_t first, second, output;
|
||||
float input[1] = {.5f}, out[1];
|
||||
assert(xtc_plugin_probe(argv[1],0,48000,&gain) == XTC_OK);
|
||||
assert(xtc_plugin_probe(argv[1],8,48000,&offset) == XTC_OK);
|
||||
gain.values[0] = 2;
|
||||
assert(xtc_graph_create(8,&g) == XTC_OK);
|
||||
assert(xtc_graph_add_plugin(g,&gain,&first) == XTC_OK);
|
||||
assert(xtc_graph_add_plugin(g,&offset,&second) == XTC_OK);
|
||||
assert(xtc_graph_add_output(g,&output) == XTC_OK);
|
||||
assert(xtc_graph_connect(g,first,second) == XTC_OK && xtc_graph_connect(g,second,output) == XTC_OK);
|
||||
assert(xtc_graph_compile(g,48000,1,&plan) == XTC_OK);
|
||||
audio = 1; assert(xtc_plan_process(plan,input,out,1) == XTC_OK && out[0] == 2); audio = 0;
|
||||
xtc_plan_destroy(plan); plan = NULL;
|
||||
// Swap identities at stable IDs: gain -> offset becomes offset -> gain.
|
||||
assert(xtc_graph_replace_plugin(g,first,&offset) == XTC_OK);
|
||||
assert(xtc_graph_replace_plugin(g,second,&gain) == XTC_OK);
|
||||
assert(xtc_graph_compile(g,48000,1,&plan) == XTC_OK);
|
||||
audio = 1; assert(xtc_plan_process(plan,input,out,1) == XTC_OK && out[0] == 3); audio = 0;
|
||||
xtc_plan_destroy(plan); xtc_graph_destroy(g);
|
||||
}
|
||||
}
|
||||
}
|
||||
puts("Plugin lifecycle, identity, layouts, processing and persisted graph checks passed.");
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue