Added VST SDK support.

This commit is contained in:
Johannes Findeisen 2026-11-06 18:13:49 +01:00
commit 8e09f58944
25 changed files with 850 additions and 23 deletions

View file

@ -87,10 +87,36 @@ static void check(const char *path, xtc_plugin_format format)
xtc_realtime_destroy(rt); xtc_graph_destroy(graph); xtc_project_destroy(p); xtc_project_destroy(loaded); unlink(document);
printf("%s identity, buffers, stereo graph, retirement, reload and missing dependency passed.\n",xtc_plugin_format_name(format));
}
static void context_check(const char *path)
{
xtc_plugin_spec spec; xtc_plugin *plugin = NULL;
void *handle, *symbol;
void (*read_context)(double *, int64_t *, double *, uint32_t *) = NULL;
float data[31] = {0}; double tempo, music; int64_t position; uint32_t flags;
assert(xtc_plugin_probe_format(XTC_PLUGIN_VST3,path,0,48000,&spec) == XTC_OK);
spec.tempo = 137000;
assert(xtc_plugin_create(&spec,48000,31,&plugin) == XTC_OK);
handle = dlopen(path,RTLD_NOW | RTLD_LOCAL); assert(handle);
symbol = dlsym(handle,"xtc_fixture_context"); assert(symbol && sizeof(symbol) == sizeof(read_context));
memcpy(&read_context,&symbol,sizeof(symbol));
audio = 1; assert(xtc_plugin_process_at(plugin,data,data,31,48000) == XTC_OK); audio = 0;
read_context(&tempo,&position,&music,&flags);
assert(tempo == 137 && position == 48000 && music == 137.0/60.0);
assert(flags == ((1U << 1) | (1U << 9) | (1U << 10)));
assert(xtc_plugin_process_at(plugin,data,data,31,0) == XTC_OK);
read_context(&tempo,&position,&music,&flags); assert(position == 0 && music == 0);
assert(xtc_plugin_process(plugin,data,data,31) == XTC_OK);
read_context(&tempo,&position,&music,&flags); assert(position == 31);
assert(xtc_plugin_process_at(plugin,data,data,31,UINT64_MAX) == XTC_ERR_INVALID_ARGUMENT);
read_context(&tempo,&position,&music,&flags); assert(position == 31);
xtc_plugin_destroy(plugin); assert(dlclose(handle) == 0);
puts("VST3 tempo, signed sample clock, seek and sequential context passed.");
}
int main(int argc,char **argv)
{
unsigned int i; xtc_plugin_spec spec; xtc_plugin *p = NULL; float data[1] = {1};
assert(argc == 4);
context_check(argv[3]);
check(argv[1],XTC_PLUGIN_CLAP); check(argv[2],XTC_PLUGIN_VST2); check(argv[3],XTC_PLUGIN_VST3);
for (i = 1; i < 4; ++i) assert(xtc_plugin_probe_format(XTC_PLUGIN_CLAP,argv[1],i,48000,&spec) != XTC_OK);
assert(xtc_plugin_probe_format(XTC_PLUGIN_CLAP,argv[1],4,48000,&spec) == XTC_OK);