Revision: 10334 http://pure-data.svn.sourceforge.net/pure-data/?rev=10334&view=rev Author: postlude Date: 2008-10-18 14:44:43 +0000 (Sat, 18 Oct 2008)
Log Message: ----------- - pd 'canvas' search path now searched for plugins in addition to LADSPA_PATH and DSSI_PATH. This means that plugin paths can now be added with [declare]
Modified Paths: -------------- trunk/externals/postlude/dssi/src/dssi~.c trunk/externals/postlude/dssi/src/dssi~.h
Modified: trunk/externals/postlude/dssi/src/dssi~.c =================================================================== --- trunk/externals/postlude/dssi/src/dssi~.c 2008-10-17 00:47:05 UTC (rev 10333) +++ trunk/externals/postlude/dssi/src/dssi~.c 2008-10-18 14:44:43 UTC (rev 10334) @@ -2096,12 +2096,17 @@ *argstr, *dll_arg, *dll_name, - *plugin_label; + *dll_path, + *plugin_label, + dll_dir[MAXPDSTRING]; + #if DEBUG post("argc = %d", argc); #endif int i, - stop; + stop, + fd; + size_t pathlen;
stop = 0;
@@ -2136,29 +2141,58 @@ #endif
if(x->dll_arg != NULL){ + /* First try to load as is: this will work if dll_arg is an + * absolute path, or the name of a library that is in DSSI_PATH + * or LADSPA_PATH environment variables */ x->dll_handle = loadLADSPAPluginLibrary(x->dll_arg); x->dll_path = (char *)x->dll_arg; + /* If that didn't work, search for it in the 'canvas' path, which + * includes the Pd search dirs and any 'extra' paths set with + * [declare] */ + fd = canvas_open(x->x_canvas, x->dll_arg, "", + dll_dir, &dll_name, MAXPDSTRING, 0); + + if (fd >= 0) + { +#if DEBUG + post("plugin directory is %s, filename is %s", + dll_dir, dll_name); +#endif + pathlen = strlen(dll_dir); + dll_path = &dll_dir[pathlen]; + sprintf(dll_path, "/%s", dll_name); + dll_path = dll_dir; + x->dll_handle = loadLADSPAPluginLibrary(dll_path); + } + else + error("dssi~: can't find plugin library in Pd paths, " + "try using [declare] to specify the path."); + }
if (x->dll_handle != NULL){ tmpstr = (char *)malloc((strlen(x->dll_arg) + 1) * sizeof(char)); strcpy(tmpstr, x->dll_arg); - if(strstr(tmpstr, ".so")){ - dll_name = strtok((char *)tmpstr, "/"); - while(strstr(dll_name, ".so") == NULL) - dll_name = strtok(NULL, "/"); - x->dll_name = (char *)malloc(sizeof(char) * - (strlen(dll_name) + 1)); - strcpy(x->dll_name, dll_name); + /* Don't bother working out the dll name if we used canvas_open() + * to get the path */ + if(dll_name == NULL){ + if(strstr(tmpstr, ".so")){ + dll_name = strtok((char *)tmpstr, "/"); + while(strstr(dll_name, ".so") == NULL) + dll_name = strtok(NULL, "/"); + x->dll_name = (char *)malloc(sizeof(char) * + (strlen(dll_name) + 1)); + strcpy(x->dll_name, dll_name); #if DEBUG - post("library name = %s", x->dll_name); + post("library name = %s", x->dll_name); #endif - free(tmpstr); - } - else{ - post("dssi~: invalid library name; must end in .so"); - return (void *) x; - } + free(tmpstr); + } + else{ + post("dssi~: invalid library name; must end in .so"); + return (void *) x; + } + } if(x->desc_func = (DSSI_Descriptor_Function)dlsym(x->dll_handle, "dssi_descriptor")){ x->is_DSSI = 1; x->descriptor = (DSSI_Descriptor *)x->desc_func(0); @@ -2289,6 +2323,7 @@ x->time_ref = (t_int)clock_getlogicaltime; x->blksize = sys_getblksize(); x->dsp = 0; + x->x_canvas = canvas_getcurrent();
pthread_mutex_init(&x->midiEventBufferMutex, NULL); return dssi_tilde_load_plugin(x, argc, argv);
Modified: trunk/externals/postlude/dssi/src/dssi~.h =================================================================== --- trunk/externals/postlude/dssi/src/dssi~.h 2008-10-17 00:47:05 UTC (rev 10333) +++ trunk/externals/postlude/dssi/src/dssi~.h 2008-10-18 14:44:43 UTC (rev 10334) @@ -40,7 +40,7 @@ #define DX7_DUMP_SIZE_BULK 4096+8
-#define VERSION 0.95 +#define VERSION 0.97 #define EVENT_BUFSIZE 1024 #define OSC_BASE_MAX 1024 #define TYPE_STRING_SIZE 20 /* Max size of event type string (must be two more bytes than needed) */ @@ -122,6 +122,7 @@ char *dll_arg, /*arg given by user - either path or dll name*/ *plugin_label; char *dll_path; /*absolute path to plugin */ + t_canvas *x_canvas; /* pointer to the canvas the object is instantiated on */ void *dll_handle; char *project_dir; /* project dircetory */ LADSPA_Handle *instanceHandles; /*was handle*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.