annotate host/test-c.c @ 525:8c18bdaad04f c++11-mutex

Avoid simple static allocation of mutex, as it could lead to mutex being destroyed before last adapter that needs to use it (since adapters are usually also static)
author Chris Cannam
date Mon, 09 Sep 2019 10:24:13 +0100
parents 632c662e95e7
children
rev   line source
Chris@393 1
Chris@393 2 #include <vamp-hostsdk/host-c.h>
Chris@393 3
Chris@393 4 #include <stdio.h>
Chris@393 5
Chris@393 6 int main(int argc, char **argv)
Chris@393 7 {
Chris@393 8 int i;
Chris@393 9 int libcount = vhGetLibraryCount();
Chris@393 10
Chris@393 11 printf("Vamp plugin libraries found:\n");
Chris@393 12 for (i = 0; i < libcount; ++i) {
Chris@393 13 printf("%d: %s\n", i, vhGetLibraryName(i));
Chris@393 14 }
Chris@393 15
Chris@393 16 printf("Going to try loading qm-vamp-plugins...\n");
Chris@393 17 int libindex = vhGetLibraryIndex("qm-vamp-plugins");
Chris@393 18 vhLibrary lib = vhLoadLibrary(libindex);
Chris@393 19 if (!lib) {
Chris@393 20 printf("Failure!\n");
Chris@393 21 return 1;
Chris@393 22 }
Chris@393 23
Chris@393 24 int plugincount = vhGetPluginCount(lib);
Chris@393 25 printf("Success: it contains %d plugins; they are:\n", plugincount);
Chris@393 26
Chris@393 27 for (i = 0; i < plugincount; ++i) {
Chris@393 28 const VampPluginDescriptor *descriptor = vhGetPluginDescriptor(lib, i);
Chris@393 29 if (!descriptor) {
Chris@393 30 printf("<unknown! failed to load>\n");
Chris@393 31 } else {
Chris@393 32 printf("%s\n", descriptor->identifier);
Chris@393 33 }
Chris@393 34 }
Chris@393 35
Chris@393 36 vhUnloadLibrary(lib);
Chris@393 37
Chris@393 38 return 0;
Chris@393 39 }
Chris@393 40