Revision: 9892 http://pure-data.svn.sourceforge.net/pure-data/?rev=9892&view=rev Author: eighthave Date: 2008-05-23 18:44:50 -0700 (Fri, 23 May 2008)
Log Message: ----------- added [plugindir( message and set default plugindir in _new*( functions
Modified Paths: -------------- trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c
Modified: trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c =================================================================== --- trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c 2008-05-24 01:20:14 UTC (rev 9891) +++ trunk/externals/pdvjtools/pdp_freeframe/pdp_freeframe.c 2008-05-24 01:44:50 UTC (rev 9892) @@ -192,7 +192,8 @@ static void pdp_freeframe_plugindir(t_pdp_freeframe *x, t_symbol *s) { x->plugindir = s; - ff_loadplugins(x, x->plugindir); + if( s != &s_) + ff_loadplugins(x, x->plugindir); }
static void pdp_freeframe_process_rgb(t_pdp_freeframe *x)
Modified: trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd =================================================================== --- trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd 2008-05-24 01:20:14 UTC (rev 9891) +++ trunk/externals/pdvjtools/pdp_frei0r/help_pdp_frei0r.pd 2008-05-24 01:44:50 UTC (rev 9892) @@ -1,7 +1,7 @@ -#N canvas 0 0 996 665 10; +#N canvas 528 22 996 665 10; #X floatatom 151 379 5 0 0 0 - - -; #X obj 196 377 hradio 15 1 0 49 empty empty empty 0 -6 0 8 -262144 --1 -1 16; +-1 -1 0; #X obj 261 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 401 171 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 @@ -20,9 +20,9 @@ #X text 205 451 <-- parameter name; #X text 232 423 <-- parameter type; #X obj 263 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 3200 1; +-1 -1 0 1; #X obj 401 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 --1 -1 4100 1; +-1 -1 0 1; #X obj 542 112 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 -1 -1 0 1; #X obj 261 234 hsl 128 15 0 1 0 0 empty empty empty -2 -6 0 8 -262144 @@ -37,7 +37,7 @@ #X msg 260 254 param 6 $1; #X msg 399 253 param 7 $1; #X msg 541 253 param 8 $1; -#N canvas 0 0 996 665 pname 0; +#N canvas 0 22 996 665 pname 0; #X obj 51 119 l2s; #X obj 80 119 l2s; #X obj 111 119 l2s; @@ -168,7 +168,7 @@ #X restore 44 44 pd input1; #X text 49 24 .mov; #X text 115 24 cam; -#X obj 102 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +#X obj 102 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #X obj 44 10 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; @@ -176,7 +176,7 @@ #X text 151 89 cam; #X obj 138 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; -#X obj 80 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1 +#X obj 80 75 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 1 ; #N canvas 222 59 450 300 input2 0; #X obj 49 181 pdp_qt; @@ -280,6 +280,7 @@ #X text 498 575 at startup ( check pd window ); #X text 13 290 WARNING : sizes of inputs; #X text 12 302 _must_ be the same; +#X msg 290 18 plugindir /usr/local/lib/frei0r; #X connect 0 0 75 3; #X connect 1 0 0 0; #X connect 2 0 5 0; @@ -326,3 +327,4 @@ #X connect 75 2 12 0; #X connect 75 3 28 0; #X connect 75 4 42 0; +#X connect 80 0 75 0;
Modified: trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c =================================================================== --- trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c 2008-05-24 01:20:14 UTC (rev 9891) +++ trunk/externals/pdvjtools/pdp_frei0r/pdp_frei0r.c 2008-05-24 01:44:50 UTC (rev 9892) @@ -87,6 +87,8 @@ int x_plugin; int x_infosok;
+ t_symbol *plugindir; + PLUGIN *plugins;
} t_pdp_frei0r; @@ -111,10 +113,10 @@ } }
-void fr_loadplugins(t_pdp_frei0r *x, char *plugindir) +void fr_loadplugins(t_pdp_frei0r *x, t_symbol *plugindirsymbol) { + char* plugindir = plugindirsymbol->s_name; char libname[PATH_MAX]; - unsigned instance, numparameters; int i; char *pluginname; void *plugin_handle; @@ -233,6 +235,13 @@ x->plugins = NULL; }
+static void pdp_frei0r_plugindir(t_pdp_frei0r *x, t_symbol *s) +{ + x->plugindir = s; + if( s != &s_) + fr_loadplugins(x, x->plugindir); +} + static void pdp_frei0r_process_rgba(t_pdp_frei0r *x) { t_pdp *newheader = pdp_packet_header(x->x_packet2); @@ -257,7 +266,7 @@ x->x_size = x->x_width*x->x_height;
//load the plugins - fr_loadplugins(x, FR_PLUGIN_DIR); + fr_loadplugins(x, x->plugindir); }
newheader->info.image.encoding = lheader->info.image.encoding; @@ -420,7 +429,7 @@ post( "frei0r : plugin out of range : %d", (t_int)f ); return; } - post ("pdp_freeframe :: %s selected, %d parameters", x->plugins[x->x_plugin].name, x->plugins[x->x_plugin].numparameters); + post ("pdp_frei0r :: %s selected, %d parameters", x->plugins[x->x_plugin].name, x->plugins[x->x_plugin].numparameters); outlet_symbol(x->x_pname, gensym( x->plugins[x->x_plugin].name ) ); outlet_float(x->x_nparams, (float)x->plugins[x->x_plugin].numparameters); for ( pi=0; pi<x->plugins[x->x_plugin].numparameters; pi++ ) @@ -602,7 +611,20 @@ //load the plugins x->x_plugin_count = 0; x->x_infosok = 0; - fr_loadplugins(x, FR_PLUGIN_DIR); + + char fr_plugin_dir[FILENAME_MAX]; + char *home = getenv("HOME"); + int home_len; + if(home != NULL) + { + home_len = strlen(home); + if(home_len >= FILENAME_MAX) + home_len = FILENAME_MAX - 1; + memcpy(fr_plugin_dir, home, home_len); + fr_plugin_dir[home_len] = '\0'; + strncpy(fr_plugin_dir, "/.frf", FILENAME_MAX - home_len); + pdp_frei0r_plugindir(x, gensym(fr_plugin_dir)); + }
//select plugin pdp_frei0r_plugin(x, f); @@ -629,6 +651,7 @@ class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_input_2, gensym("pdp2"), A_SYMBOL, A_DEFFLOAT, A_NULL); class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_plugin, gensym("plugin"), A_FLOAT, A_NULL); class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_param, gensym("param"), A_GIMME, A_NULL); + class_addmethod(pdp_frei0r_class, (t_method)pdp_frei0r_plugindir, gensym("plugindir"), A_SYMBOL, A_NULL);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.