From ebe35fe98381ff6dcabf5a1a86ed5e05e4e992b0 Mon Sep 17 00:00:00 2001 From: Jamie Bullock Date: Thu, 2 Feb 2012 19:16:50 +0000 Subject: - simplified file layout svn path=/trunk/externals/postlude/; revision=15936 --- pluginhost~/pluginhost~.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 pluginhost~/pluginhost~.c (limited to 'pluginhost~/pluginhost~.c') diff --git a/pluginhost~/pluginhost~.c b/pluginhost~/pluginhost~.c new file mode 100644 index 0000000..76faff1 --- /dev/null +++ b/pluginhost~/pluginhost~.c @@ -0,0 +1,95 @@ +/* pluginhost~ - A plugin host for Pd + * + * Copyright (C) 2006 Jamie Bullock and others + * + * This file incorporates code from the following sources: + * + * jack-dssi-host (BSD-style license): Copyright 2004 Chris Cannam, Steve Harris and Sean Bolton. + * + * Hexter (GPL license): Copyright (C) 2004 Sean Bolton and others. + * + * plugin~ (GPL license): Copyright (C) 2000 Jarno Seppänen, remIXed 2005 + * + * liblo (CPL license): Copyright (C) 2004 Steve Harris + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + + +#include +#include + +#include "ph_common.h" +#include "handlers_pd.h" + +static t_class *ph_class; + +static void *ph_new(t_symbol *s, t_int argc, t_atom *argv) +{ + + ph *x = (ph *)pd_new(ph_class); + post("\n========================================\n" + "%s(): version %.2f\n========================================\n", + PH_NAME, PH_VERSION); + + ph_init_plugin(x); + + x->sr = (int)sys_getsr(); + x->sr_inv = 1 / (t_float)x->sr; + x->dsp = 0; + x->time_ref = (t_int)clock_getlogicaltime; + x->blksize = sys_getblksize(); + x->x_canvas = canvas_getcurrent(); + + return ph_load_plugin(x, argc, argv); + +} + +static void ph_free(ph *x) +{ + ph_quit_plugin(x); + ph_free_plugin(x); +} + +static void ph_sigchld_handler(int sig) +{ + wait(NULL); +} + +void pluginhost_tilde_setup(void) +{ + + ph_class = class_new(gensym("pluginhost~"), (t_newmethod)ph_new, + (t_method)ph_free, sizeof(ph), 0, A_GIMME, 0); + class_addlist(ph_class, handle_pd_list); + class_addbang(ph_class, handle_pd_bang); + class_addmethod(ph_class, (t_method)handle_pd_dsp, gensym("dsp"), 0); + class_addmethod (ph_class,(t_method)handle_pd_info, gensym ("info"), 0); + class_addmethod(ph_class, (t_method)handle_pd_dssi, + gensym("dssi"), A_GIMME, 0); + class_addmethod (ph_class,(t_method)handle_pd_control, + gensym ("control"),A_DEFSYM, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod (ph_class,(t_method)handle_pd_listplugins, + gensym ("listplugins"),0); + class_addmethod (ph_class,(t_method)handle_pd_reset, + gensym ("reset"), A_DEFFLOAT, 0); + class_addmethod (ph_class, (t_method)handle_pd_osc, + gensym("osc"), A_GIMME, 0); + class_sethelpsymbol(ph_class, gensym("pluginhost~-help")); + + CLASS_MAINSIGNALIN(ph_class, ph, f); + signal(SIGCHLD, ph_sigchld_handler); +} + -- cgit v1.2.1