simple LADSPA loader

01/11/2012 § 1 Comment

Ladspa has always interested me. So I just happen to play with Ladspa. I am sharing one the many things I did with it.

               Note that the best guide to Ladspa api is ladspa.h itself.

Following is a sample code to load a Ladspa library and display its Name or whatever attribute you like. You can do that by changing fllowing line in the code below:

                               puts (((*fun)(0))->Name);

Where ‘fun’ is a Ladspa descriptor and and filters.so is a Ladspa library.

The following code is for Linux based OS (which you might have inferred by seeing the use of ‘dlopen’).

#include <stdlib.h>
#include <stdio.h>
#include <dlfcn.h>

#include "ladspa.h"

int main(int argc, char **argv)
{
   void *handle;
   LADSPA_Descriptor* (*fun) (unsigned long Index); 
   char *error; 
   handle = dlopen ("./filters.so", RTLD_NOW);

   if (!handle)
      fputs (dlerror(), stderr); exit(1);

   fun = dlsym(handle, "ladspa_descriptor");

   if ((error = dlerror()) != NULL)
      fputs(error, stderr); exit(1);

   puts (((*fun)(0))->Name); 
   dlclose(handle);
}

If you can’t get it to work shout out loud in comments section below. 🙂

Advertisements

Tagged: , , , ,

§ One Response to simple LADSPA loader

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading simple LADSPA loader at a tryst with DSP.

meta

%d bloggers like this: