From dbc59d5ade366a6af1b1d02ea3551004be13197a Mon Sep 17 00:00:00 2001 From: carmen rocco Date: Sat, 30 Apr 2005 07:38:55 +0000 Subject: enter the knifeman svn path=/trunk/externals/plugin~/; revision=2859 --- ChangeLog | 9 +++ plugin~-help.pd | 239 +++++++++++++++++++++++++++++--------------------------- plugin~.c | 64 +++++++-------- plugin~.h | 6 +- 4 files changed, 162 insertions(+), 156 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0da2e25..a250f0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +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/ + + new methods: + * 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/plugin~-help.pd b/plugin~-help.pd index 4723849..19bf26a 100644 --- a/plugin~-help.pd +++ b/plugin~-help.pd @@ -1,126 +1,131 @@ -#N canvas 146 82 1105 734 12; -#X floatatom 415 488 0 0 555 0 - - -; -#X msg 414 467 440; -#X obj 359 483 loadbang; -#X msg 416 508 control freq \$1; -#X msg 318 507 control amp \$1; -#X msg 316 464 0.7; -#X floatatom 316 487 0 0 1 0 - - -; -#X msg 67 351 control gain \$1; -#X floatatom 67 326 0 0 1 0 - - -; -#X msg 66 300 0.7; -#X obj 378 534 plugin~ sine_fcac; -#X obj 217 365 adc~; -#X obj 200 436 dac~; -#X obj 66 269 loadbang; -#N canvas 0 0 450 300 graph1 0; -#X array array1 100 float 0; -#X coords 0 1 100 -1 200 140 1; -#X restore 84 465 graph; -#X obj 377 558 tabwrite~ array1; -#X obj 314 578 metro 500; -#X msg 312 557 1; -#X obj 313 534 loadbang; -#X msg 14 310 reset; -#X msg 20 258 info; -#X msg 21 234 listplugins; -#X obj 544 105 route id name label maker; -#X obj 543 103 widget q q1 -bg black -fg "#ff0045" -height 42 -width +#N canvas 0 82 939 822 12; +#X obj 497 2 adc~; +#X obj 450 78 dac~; +#X msg 240 3 info; +#X msg 274 2 listplugins; +#X obj 388 105 route id name label maker; +#X obj 387 103 widget q q1 -bg black -fg "#ff0045" -height 42 -width 5; -#X obj 574 103 widget q q1 -bg black -fg white -height 42 -width 23 +#X obj 418 103 widget q q1 -bg black -fg white -height 42 -width 23 ; -#X obj 715 702 print; -#X obj 599 622 route scroll; -#X msg 600 645 scroll \$1; -#X obj 578 106 prepend add; -#X obj 713 103 widget q q1 -bg black -fg orange -height 42 -width 16 +#X obj 443 622 route scroll; +#X msg 444 645 scroll \$1; +#X obj 422 106 prepend add; +#X obj 557 103 widget q q1 -bg black -fg orange -height 42 -width 16 ; -#X obj 723 642 route scroll; -#X msg 722 667 scroll \$1; -#X obj 547 644 route scroll; -#X msg 547 667 scroll \$1; -#X obj 842 629 route scroll; -#X msg 840 652 scroll \$1; -#X obj 810 103 widget q q1 -bg black -fg cyan -height 42 -width 49 +#X obj 567 642 route scroll; +#X msg 566 667 scroll \$1; +#X obj 391 644 route scroll; +#X msg 391 667 scroll \$1; +#X obj 686 629 route scroll; +#X msg 684 652 scroll \$1; +#X obj 654 103 widget q q1 -bg black -fg cyan -height 42 -width 49 ; -#X obj 546 106 prepend add; -#X obj 716 107 prepend add; -#X obj 814 109 prepend add; -#X obj 96 389 plugin~ tap_equalizer; -#X obj 165 87 widget q q1 -width 24 -bg gray -fg purple -height 18 +#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 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 87 76 a2l; +#X msg 238 70 add \$1; +#X msg 189 70 add \$1; +#X obj 187 69 widget q q1 -width 8 -bg gray -fg purple -height 18; +#X obj 237 69 widget q q1 -width 8 -bg gray -fg purple -height 18; +#X msg 188 70 clear; +#X obj 113 425 widget ngrid n1 #w 256 #h 256; +#X obj 193 325 niagara 1; +#X obj 193 382 glue; +#X obj 193 363 a2l; +#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 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 obj 234 47 unpack s f f; -#X obj 46 7 route port; -#X obj 69 32 route in; -#X obj 129 24 route control; -#X obj 197 50 a2l; -#X msg 364 66 add \$1; -#X msg 316 66 add \$1; -#X obj 311 87 widget q q1 -width 8 -bg gray -fg purple -height 18; -#X obj 361 87 widget q q1 -width 8 -bg gray -fg purple -height 18; -#X msg 120 224 clear; -#X connect 0 0 3 0; -#X connect 1 0 0 0; -#X connect 2 0 1 0; -#X connect 2 0 5 0; -#X connect 3 0 10 0; -#X connect 4 0 10 0; -#X connect 5 0 6 0; -#X connect 6 0 4 0; -#X connect 7 0 40 0; -#X connect 8 0 7 0; -#X connect 9 0 8 0; -#X connect 10 1 15 0; -#X connect 11 0 40 1; -#X connect 13 0 9 0; -#X connect 16 0 15 0; -#X connect 17 0 16 0; -#X connect 18 0 17 0; -#X connect 19 0 40 0; -#X connect 20 0 51 0; -#X connect 20 0 40 0; -#X connect 21 0 40 0; -#X connect 22 0 37 0; -#X connect 22 1 28 0; -#X connect 22 2 38 0; -#X connect 22 3 39 0; -#X connect 23 0 32 0; -#X connect 24 0 26 0; +#X msg 114 428 redefine; +#X obj 242 344 expr $f1 + ($f2-$f1)/2.; +#X obj 193 344 Append; +#X text 41 51 param; +#X text 211 52 min; +#X text 261 52 max; +#X text 388 85 id; +#X text 522 85 name; +#X text 628 85 label; +#X text 916 85 maker; +#X obj 559 667 route symbol; +#X msg 427 28 plug \$1; +#X connect 0 0 21 1; +#X connect 0 1 43 1; +#X connect 2 0 32 0; +#X connect 2 0 21 0; +#X connect 3 0 21 0; +#X connect 4 0 18 0; +#X connect 4 1 9 0; +#X connect 4 2 19 0; +#X connect 4 3 20 0; +#X connect 5 0 13 0; +#X connect 6 0 7 0; +#X connect 7 0 8 0; +#X connect 8 0 5 0; +#X connect 8 0 10 0; +#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 11 0 12 0; +#X connect 12 0 5 0; +#X connect 12 0 6 0; +#X connect 12 0 17 0; +#X connect 13 0 14 0; +#X connect 14 0 6 0; +#X connect 14 0 10 0; +#X connect 14 0 17 0; +#X connect 15 0 16 0; +#X connect 16 0 5 0; +#X connect 16 0 6 0; +#X connect 16 0 10 0; +#X connect 17 0 15 0; +#X connect 18 0 5 0; +#X connect 19 0 10 0; +#X connect 20 0 17 0; +#X connect 21 0 4 0; +#X connect 21 0 24 0; +#X connect 21 1 1 0; +#X connect 23 0 22 0; +#X connect 23 1 29 0; +#X connect 23 2 28 0; +#X connect 24 0 25 0; +#X connect 25 0 26 0; #X connect 26 0 27 0; +#X connect 26 0 34 0; #X connect 27 0 23 0; -#X connect 27 0 29 0; -#X connect 27 0 36 0; -#X connect 28 0 24 0; +#X connect 28 0 31 0; #X connect 29 0 30 0; -#X connect 29 0 25 0; -#X connect 30 0 31 0; -#X connect 31 0 23 0; -#X connect 31 0 24 0; -#X connect 31 0 36 0; -#X connect 32 0 33 0; -#X connect 33 0 24 0; -#X connect 33 0 29 0; -#X connect 33 0 36 0; -#X connect 34 0 35 0; -#X connect 35 0 23 0; -#X connect 35 0 24 0; -#X connect 35 0 29 0; -#X connect 36 0 34 0; -#X connect 37 0 23 0; -#X connect 38 0 29 0; -#X connect 39 0 36 0; -#X connect 40 0 22 0; +#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 33 0 40 0; +#X connect 34 0 47 0; +#X connect 34 1 46 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 40 1 12 0; -#X connect 42 0 41 0; -#X connect 42 1 48 0; -#X connect 42 2 47 0; -#X connect 43 0 44 0; -#X connect 44 0 45 0; -#X connect 45 0 46 0; -#X connect 46 0 42 0; -#X connect 47 0 50 0; -#X connect 48 0 49 0; -#X connect 51 0 49 0; -#X connect 51 0 41 0; -#X connect 51 0 50 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 55 0 56 0; +#X connect 56 0 43 0; diff --git a/plugin~.c b/plugin~.c index 1525559..7986eed 100644 --- a/plugin~.c +++ b/plugin~.c @@ -1,9 +1,7 @@ /* plugin~, a Pd tilde object for hosting LADSPA/VST plug-ins Copyright (C) 2000 Jarno Seppänen - remIXed 2005 Carmen Rocco - $Id: plugin~.c,v 1.3 2005-04-29 00:43:36 ix9 Exp $ - - This file is part of plugin~. + remIXed 2005 + $Id: plugin~.c,v 1.4 2005-04-30 07:38:55 ix9 Exp $ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -53,8 +51,8 @@ void plugin_tilde_setup (void) class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_control,gensym ("control"),A_DEFSYM, A_DEFFLOAT, 0); 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"),0); - class_addmethod (plugin_tilde_class,(t_method)plugin_tilde_bypass,gensym ("bypass"),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_reset,gensym ("reset"),0); class_addmethod (plugin_tilde_class,nullfn,gensym ("signal"),0); } @@ -74,36 +72,30 @@ static void* plugin_tilde_new (t_symbol* s_name, t_symbol* s_lib_name) x->num_audio_inputs = 2; x->num_audio_outputs = 2; x->num_control_inputs = 1; - x->num_control_outputs = 0; + x->num_control_outputs = 1; x->audio_inlets = NULL; x->audio_outlets = NULL; x->control_outlet = NULL; x->dsp_vec = NULL; x->dsp_vec_length = 0; - + if (s_lib_name != NULL) { if (s_lib_name->s_name == NULL || strlen (s_lib_name->s_name) == 0) { - /* Search for the plugin library */ 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"); - goto PLUGIN_TILDE_NEW_RETURN_NULL; } } else { - /* Search in the given plugin library */ x->plugin_library_filename = strdup (s_lib_name->s_name); } - /* Load LADSPA/VST plugin */ if (plugin_tilde_open_plugin (x, s_name->s_name, x->plugin_library_filename, - (unsigned long)sys_getsr ())) { + (unsigned long)sys_getsr ())) post("plugin~: Unable to open plugin"); - goto PLUGIN_TILDE_NEW_RETURN_NULL; - } } - + /* Create in- and outlet(s) */ /* Allocate memory for in- and outlet pointers */ @@ -135,13 +127,6 @@ static void* plugin_tilde_new (t_symbol* s_name, t_symbol* s_lib_name) assert (x->dsp_vec != NULL); return x; - PLUGIN_TILDE_NEW_RETURN_NULL: - if (x->plugin_library_filename != NULL) { - free ((void*)x->plugin_library_filename); - x->plugin_library_filename = NULL; - } - return NULL; /* Indicate error to Pd */ - } static void plugin_tilde_free (Pd_Plugin_Tilde* x) @@ -225,7 +210,7 @@ static t_int* plugin_tilde_perform (t_int* w) /* precondition(s) */ assert (w != NULL); - + /* Unpack DSP parameter vector */ x = (Pd_Plugin_Tilde*)(w[1]); num_samples = (int)(w[2]); @@ -279,11 +264,11 @@ static void plugin_tilde_control (Pd_Plugin_Tilde* x, } static void plugin_tilde_info (Pd_Plugin_Tilde* x) { - assert (x != NULL); unsigned port_index = 0; - unsigned input_count = 0; - unsigned output_count = 0; t_atom at[5]; + LADSPA_PortDescriptor port_type; + LADSPA_PortRangeHintDescriptor iHintDescriptor; + at[0].a_type = A_SYMBOL; at[1].a_type = A_SYMBOL; at[2].a_type = A_SYMBOL; @@ -291,8 +276,6 @@ static void plugin_tilde_info (Pd_Plugin_Tilde* x) { at[4].a_type = A_FLOAT; for (port_index = 0; port_index < x->plugin.ladspa.type->PortCount; port_index++) { - LADSPA_PortDescriptor port_type; - LADSPA_PortRangeHintDescriptor iHintDescriptor; port_type = x->plugin.ladspa.type->PortDescriptors[port_index]; iHintDescriptor = x->plugin.ladspa.type->PortRangeHints[port_index].HintDescriptor; @@ -316,20 +299,23 @@ static void plugin_tilde_info (Pd_Plugin_Tilde* x) { outlet_anything (x->control_outlet, gensym ("port"), 5, at); } - } static void plugin_tilde_list (Pd_Plugin_Tilde* x) { - post("listing plugins\n"); - LADSPAPluginSearch(plugin_tilde_describe,x); + void* user_data[1]; + user_data[0] = x; + LADSPAPluginSearch(plugin_tilde_ladspa_describe,(void*)user_data); } -static void plugin_tilde_describe(const char * pcFullFilename, +static void plugin_tilde_ladspa_describe(const char * pcFullFilename, void * pvPluginHandle, - LADSPA_Descriptor_Function fDescriptorFunction, Pd_Plugin_Tilde* x) { + LADSPA_Descriptor_Function fDescriptorFunction, void* user_data) { + + Pd_Plugin_Tilde* x = (((void**)user_data)[0]); t_atom at[1]; const LADSPA_Descriptor * psDescriptor; long lIndex; + at[0].a_type = A_SYMBOL; at[0].a_w.w_symbol = gensym ((char*)pcFullFilename); @@ -356,10 +342,16 @@ static void plugin_tilde_describe(const char * pcFullFilename, static void plugin_tilde_bypass (Pd_Plugin_Tilde* x) { } -static void plugin_tilde_plug (Pd_Plugin_Tilde* x) { +static void plugin_tilde_plug (Pd_Plugin_Tilde* x, t_symbol* plug_name) { + plugin_tilde_ladspa_close_plugin(x); + x->plugin_library_filename = NULL; + x->plugin_library_filename = plugin_tilde_search_plugin (x, plug_name->s_name); + if (x->plugin_library_filename == NULL) + post("plugin~: plugin not found in any library"); + if (plugin_tilde_open_plugin (x, plug_name->s_name, x->plugin_library_filename,(unsigned long)sys_getsr ())) + post("plugin~: Unable to open plugin"); } - static void plugin_tilde_reset (Pd_Plugin_Tilde* x) { /* precondition(s) */ diff --git a/plugin~.h b/plugin~.h index a77000f..99df20d 100644 --- a/plugin~.h +++ b/plugin~.h @@ -79,7 +79,7 @@ static void plugin_tilde_control (Pd_Plugin_Tilde* x, /* First inlet message callback for "control" messages */ 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); +static void plugin_tilde_plug (Pd_Plugin_Tilde* x, t_symbol* plug_name); static void plugin_tilde_bypass (Pd_Plugin_Tilde* x); /* First inlet message callback for "reset" messages */ static void plugin_tilde_reset (Pd_Plugin_Tilde* x); @@ -135,10 +135,10 @@ void plugin_tilde_ladspa_set_control_input_by_index (Pd_Plugin_Tilde* x, /* Control output is handled with plugin_tilde_emit_control_output() callback */ /* Local subroutines */ -static void plugin_tilde_describe (const char* full_filename, +static void plugin_tilde_ladspa_describe (const char* full_filename, void* plugin_handle, LADSPA_Descriptor_Function descriptor_function, - Pd_Plugin_Tilde* x); + void* user_data); static void plugin_tilde_ladspa_search_plugin_callback (const char* full_filename, void* plugin_handle, LADSPA_Descriptor_Function descriptor_function, -- cgit v1.2.1