Sweep [Home] [Tutorials] Hosted at SourceForge

Developing Sweep Plugins

PreviousContentsNext

Using LADSPA effects plugins

The usual way to make a proc available for use with Sweep is to build it into a shared library file. When building a shared library to contain one or more procs you must define a structure of type sw_plugin with the name "plugin". This is the only name that should be exposed in the library's symbol table; declare all other functions and global variables as static. If multiple procedures share common code or data then place them in the same plugin library. A plugin must not rely on any other particular plugin being loaded.

typedef struct _sw_plugin sw_plugin; struct _sw_plugin { /* plugin_init () returns a list of procs */ GList * (*plugin_init) (void); /* plugin_cleanup() frees the plugin's private data structures */ void (*plugin_cleanup) (void); };

An sw_plugin structure contains two members, a plugin_init function that takes no arguments and returns a list of procs, and a void plugin_cleanup function.

The initialisation is performed through a function call and can instantiate an indeterminate number of procs. This allows the creation of plugins which may not necessarily know when built how many procs they will create; for example, the LADSPA meta plugin dynamically creates a proc corresponding to every LADSPA function it can find in all the LADSPA plugins it can find.

In the usual case where the procs are known at build time (ie. they consist of functions within the plugin library) the plugin_init function can simply construct a GList out of these known procs, each of which can be statically defined. This list is constructed using g_list_append(); see for more information on using GLists.

PreviousContentsNext

Copyright © 2000 Conrad Parker.