Created
June 24, 2019 13:44
-
-
Save jpcima/3dfd22ee963a61be5af188f558c65a1c to your computer and use it in GitHub Desktop.
load-dssi.cc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Usage: load-dssi /usr/lib/dssi/libzynaddsubfx_dssi.so | |
Build (without pthread): | |
g++ -O2 -g -o load-dssi load-dssi.cc -ldl | |
Build (with pthread): | |
g++ -O2 -g -o load-dssi load-dssi.cc -ldl -pthread | |
*/ | |
#include <dssi.h> | |
#include <dlfcn.h> | |
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
if (argc != 2) | |
return 1; | |
void *dlh = dlopen(argv[1], RTLD_LAZY); | |
if (!dlh) | |
return 1; | |
DSSI_Descriptor_Function fn = (DSSI_Descriptor_Function) | |
dlsym(dlh, "dssi_descriptor"); | |
if (!fn) | |
return 1; | |
const DSSI_Descriptor *desc = fn(0); | |
if (!desc) | |
return 1; | |
const LADSPA_Descriptor *ldesc = desc->LADSPA_Plugin; | |
if (!ldesc) | |
return 1; | |
LADSPA_Handle handle = ldesc->instantiate(ldesc, 44100); | |
ldesc->cleanup(handle); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment