aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-24 01:44:50 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2008-05-24 01:44:50 +0000
commitfb5547a65d805fae2daa06ccf3b9dea234ffc4d8 (patch)
treef79356c767b56487aa7330da0a8167dc52675329
parente9c07cc20fd83680ee7aeb93a530eb9d29aa1902 (diff)
added [plugindir( message and set default plugindir in _new*( functions
svn path=/trunk/externals/pdvjtools/; revision=9892
-rw-r--r--pdp_freeframe/pdp_freeframe.c3
-rw-r--r--pdp_frei0r/help_pdp_frei0r.pd16
-rw-r--r--pdp_frei0r/pdp_frei0r.c33
3 files changed, 39 insertions, 13 deletions
diff --git a/pdp_freeframe/pdp_freeframe.c b/pdp_freeframe/pdp_freeframe.c
index 3bbe767..7266bd0 100644
--- a/pdp_freeframe/pdp_freeframe.c
+++ b/pdp_freeframe/pdp_freeframe.c
@@ -192,7 +192,8 @@ void ff_freeplugins(t_pdp_freeframe *x)
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)
diff --git a/pdp_frei0r/help_pdp_frei0r.pd b/pdp_frei0r/help_pdp_frei0r.pd
index 0898526..42c82d5 100644
--- a/pdp_frei0r/help_pdp_frei0r.pd
+++ b/pdp_frei0r/help_pdp_frei0r.pd
@@ -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 @@ Promesberger and Martin Bayer;
#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 @@ Promesberger and Martin Bayer;
#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 @@ Promesberger and Martin Bayer;
#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 @@ Promesberger and Martin Bayer;
#X connect 75 2 12 0;
#X connect 75 3 28 0;
#X connect 75 4 42 0;
+#X connect 80 0 75 0;
diff --git a/pdp_frei0r/pdp_frei0r.c b/pdp_frei0r/pdp_frei0r.c
index 3a66147..7e6c176 100644
--- a/pdp_frei0r/pdp_frei0r.c
+++ b/pdp_frei0r/pdp_frei0r.c
@@ -87,6 +87,8 @@ typedef struct pdp_frei0r_struct
int x_plugin;
int x_infosok;
+ t_symbol *plugindir;
+
PLUGIN *plugins;
} t_pdp_frei0r;
@@ -111,10 +113,10 @@ static void scan_plugins(t_pdp_frei0r *x, char *plugindir)
}
}
-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 @@ void fr_freeplugins(t_pdp_frei0r *x)
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 @@ static void pdp_frei0r_process_rgba(t_pdp_frei0r *x)
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 @@ static void pdp_frei0r_plugin(t_pdp_frei0r *x, t_floatarg f)
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 @@ void *pdp_frei0r_new(t_floatarg f)
//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 @@ void pdp_frei0r_setup(void)
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);
}