From 19821de5aa474d16896f4a516817fc8be3c0f762 Mon Sep 17 00:00:00 2001 From: carmen rocco Date: Sat, 30 Apr 2005 20:30:53 +0000 Subject: adding 'active', fixing one of the segfaults... svn path=/trunk/externals/plugin~/; revision=2860 --- ChangeLog | 6 ++++-- SConstruct | 2 +- plugin~-help.pd | 47 +++++++++++++++++++++++++---------------------- plugin~.c | 42 +++++++++++++++++++++--------------------- plugin~.h | 3 ++- 5 files changed, 53 insertions(+), 47 deletions(-) diff --git a/ChangeLog b/ChangeLog index a250f0a..95a600d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,14 @@ 2005-05-00 Carmen Rocco * VST support is gone, actually, it was never here, but removed some stuff to clean it up, VST? detour to /externals/grill/vst/ - + * you can create the plugin without arguments, it will default to 2 channels + new methods: + * active: enable or disable the plugin * listplugins: lists all your LADSPA plugins... * info: info on the current plugin, like assignable params, etc. * plug: load a new plug - + 2001-04-04 Jarno Seppänen * Released version 0.2 diff --git a/SConstruct b/SConstruct index 3d3b08d..2988364 100644 --- a/SConstruct +++ b/SConstruct @@ -3,7 +3,7 @@ import os import re prefix = "/usr/local/lib/pd" -env = Environment(CPPPATH = Split(prefix + '/src /usr/include /usr/local/include . ../../pd/src ../../src src'), CPPDEFINES=['PD','UNIX'], SHLIBPREFIX = '', SHLIBSUFFIX = '.pd_linux', CCFLAGS = '-pipe -O2 -fPIC') +env = Environment(CPPPATH = Split(prefix + '/src /usr/include /usr/local/include . ../../pd/src ../../src src'), CPPDEFINES=['PD','UNIX'], SHLIBPREFIX = '', SHLIBSUFFIX = '.pd_linux', CCFLAGS = '-pipe -O2 -g') external = env.SharedLibrary('plugin~',glob.glob('*.c')) env.Alias('install', env.Install(os.path.join(prefix, 'extra'), external)) diff --git a/plugin~-help.pd b/plugin~-help.pd index 19bf26a..925a651 100644 --- a/plugin~-help.pd +++ b/plugin~-help.pd @@ -1,4 +1,4 @@ -#N canvas 0 82 939 822 12; +#N canvas 0 220 950 684 12; #X obj 497 2 adc~; #X obj 450 78 dac~; #X msg 240 3 info; @@ -24,12 +24,12 @@ #X obj 390 106 prepend add; #X obj 560 107 prepend add; #X obj 658 109 prepend add; -#X obj 298 47 plugin~ tap_equalizer; +#X obj 319 50 plugin~ tap_equalizer; #X obj 41 69 widget q q1 -width 24 -bg gray -fg purple -height 18; #X obj 107 76 unpack s f f; -#X obj 298 66 route port; -#X obj 298 85 route in; -#X obj 298 104 route control; +#X obj 298 100 route port; +#X obj 298 119 route in; +#X obj 298 138 route control; #X obj 87 76 a2l; #X msg 238 70 add \$1; #X msg 189 70 add \$1; @@ -43,10 +43,9 @@ #X obj 193 401 prepend add; #X msg 112 393 move swarm; #X msg 120 373 move; -#X obj 335 28 prepend control; -#X text 557 7 plugin~; +#X obj 369 8 prepend control; +#X text 557 7 plusgin~; #X text 570 23 currently supports LADSPA; -#X obj 427 47 plugin~ tap_equalizer; #X text 643 400 if you can see this \, you need widgets from /extensions/gui/ix ; #X msg 114 428 redefine; @@ -60,11 +59,13 @@ #X text 628 85 label; #X text 916 85 maker; #X obj 559 667 route symbol; -#X msg 427 28 plug \$1; +#X msg 497 45 plug \$1; +#X obj 590 59 plugain~; +#X obj 422 28 demux; #X connect 0 0 21 1; -#X connect 0 1 43 1; +#X connect 0 1 56 1; #X connect 2 0 32 0; -#X connect 2 0 21 0; +#X connect 2 0 57 0; #X connect 3 0 21 0; #X connect 4 0 18 0; #X connect 4 1 9 0; @@ -78,7 +79,7 @@ #X connect 8 0 17 0; #X connect 9 0 6 0; #X connect 10 0 11 0; -#X connect 10 0 55 0; +#X connect 10 0 54 0; #X connect 11 0 12 0; #X connect 12 0 5 0; #X connect 12 0 6 0; @@ -111,21 +112,23 @@ #X connect 32 0 30 0; #X connect 32 0 22 0; #X connect 32 0 31 0; -#X connect 32 0 45 0; +#X connect 32 0 44 0; #X connect 33 0 40 0; -#X connect 34 0 47 0; -#X connect 34 1 46 0; +#X connect 34 0 46 0; +#X connect 34 1 45 0; #X connect 34 1 35 1; #X connect 35 0 37 0; #X connect 36 0 35 0; #X connect 37 0 33 0; #X connect 38 0 33 0; #X connect 39 0 33 0; -#X connect 40 0 21 0; -#X connect 40 0 43 0; -#X connect 43 1 1 1; -#X connect 45 0 33 0; -#X connect 46 0 47 1; -#X connect 47 0 36 0; +#X connect 40 0 57 0; +#X connect 44 0 33 0; +#X connect 45 0 46 1; +#X connect 46 0 36 0; +#X connect 54 0 55 0; #X connect 55 0 56 0; -#X connect 56 0 43 0; +#X connect 56 0 24 0; +#X connect 56 1 1 1; +#X connect 57 0 21 0; +#X connect 57 1 56 0; diff --git a/plugin~.c b/plugin~.c index 7986eed..eca5d0f 100644 --- a/plugin~.c +++ b/plugin~.c @@ -1,7 +1,7 @@ /* plugin~, a Pd tilde object for hosting LADSPA/VST plug-ins Copyright (C) 2000 Jarno Seppänen remIXed 2005 - $Id: plugin~.c,v 1.4 2005-04-30 07:38:55 ix9 Exp $ + $Id: plugin~.c,v 1.5 2005-04-30 20:30:53 ix9 Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -52,7 +52,7 @@ void plugin_tilde_setup (void) class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_info,gensym ("info"),0); class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_list,gensym ("listplugins"),0); class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_plug,gensym ("plug"),A_DEFSYM,0); - class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_bypass,gensym ("bypass"),A_DEFFLOAT,0); + class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_active,gensym ("active"),A_DEFFLOAT,0); class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_reset,gensym ("reset"),0); class_addmethod (plugin_tilde_class,nullfn,gensym ("signal"),0); } @@ -78,22 +78,20 @@ static void* plugin_tilde_new (t_symbol* s_name, t_symbol* s_lib_name) x->control_outlet = NULL; x->dsp_vec = NULL; x->dsp_vec_length = 0; + x->dsp_active = 0; - if (s_lib_name != NULL) { - if (s_lib_name->s_name == NULL || strlen (s_lib_name->s_name) == 0) { + if (s_name->s_name != NULL) { + if (s_lib_name->s_name == NULL || strlen (s_lib_name->s_name) == 0) x->plugin_library_filename = plugin_tilde_search_plugin (x, s_name->s_name); - if (x->plugin_library_filename == NULL) { - post("plugin~: plugin not found in any library"); - } - } - else { + else x->plugin_library_filename = strdup (s_lib_name->s_name); + if (x->plugin_library_filename != NULL) { + if (plugin_tilde_open_plugin (x, + s_name->s_name, + x->plugin_library_filename, + (unsigned long)sys_getsr ())) + post("plugin~: Unable to open plugin"); } - if (plugin_tilde_open_plugin (x, - s_name->s_name, - x->plugin_library_filename, - (unsigned long)sys_getsr ())) - post("plugin~: Unable to open plugin"); } /* Create in- and outlet(s) */ @@ -339,7 +337,10 @@ static void plugin_tilde_ladspa_describe(const char * pcFullFilename, dlclose(pvPluginHandle); } -static void plugin_tilde_bypass (Pd_Plugin_Tilde* x) { +static void plugin_tilde_active (Pd_Plugin_Tilde* x, t_float active) { + + x->dsp_active = active; + } static void plugin_tilde_plug (Pd_Plugin_Tilde* x, t_symbol* plug_name) { @@ -416,11 +417,10 @@ static int plugin_tilde_open_plugin (Pd_Plugin_Tilde* x, ret = plugin_tilde_ladspa_open_plugin (x, name, lib_name, sample_rate); - - - post("plugin~: plugin active"); - - + if (ret == 0) { + x->dsp_active = 1; + post("plugin~: plugin active"); + } // plugin_tilde_info (x); @@ -446,9 +446,9 @@ static void plugin_tilde_close_plugin (Pd_Plugin_Tilde* x) static void plugin_tilde_apply_plugin (Pd_Plugin_Tilde* x) { + if (x->dsp_active == 1) plugin_tilde_ladspa_apply_plugin (x); - } static void plugin_tilde_connect_audio (Pd_Plugin_Tilde* x, diff --git a/plugin~.h b/plugin~.h index 99df20d..5011682 100644 --- a/plugin~.h +++ b/plugin~.h @@ -53,6 +53,7 @@ typedef struct /* Pd's way of passing parameters to the DSP routine */ t_int* dsp_vec; unsigned dsp_vec_length; + unsigned dsp_active; } Pd_Plugin_Tilde; @@ -80,7 +81,7 @@ static void plugin_tilde_control (Pd_Plugin_Tilde* x, static void plugin_tilde_list (Pd_Plugin_Tilde* x); static void plugin_tilde_info (Pd_Plugin_Tilde* x); static void plugin_tilde_plug (Pd_Plugin_Tilde* x, t_symbol* plug_name); -static void plugin_tilde_bypass (Pd_Plugin_Tilde* x); +static void plugin_tilde_active (Pd_Plugin_Tilde* x, t_float active); /* First inlet message callback for "reset" messages */ static void plugin_tilde_reset (Pd_Plugin_Tilde* x); -- cgit v1.2.1