aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-11-12 00:42:56 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2012-11-12 00:42:56 +0000
commitf8004ff347c804227a6205fbcc579898bf059136 (patch)
treeb54b4934443fd54aefcd574fe5707ced9923bdca
parentbe66bbb07d52fcc0fa295e76286cef627e75a5a8 (diff)
completed conversion to Library Template style, including separate files for each object, shared code in lib files, etc.
svn path=/trunk/externals/jackx/; revision=16536
-rw-r--r--Makefile4
-rw-r--r--README.txt (renamed from README)0
-rw-r--r--jack-connect.c180
-rw-r--r--jack-ports.c233
-rw-r--r--jackx-meta.pd2
-rw-r--r--jackx.c399
-rw-r--r--libjackx.c30
-rw-r--r--libjackx.h22
8 files changed, 468 insertions, 402 deletions
diff --git a/Makefile b/Makefile
index 3fbcdd9..349fe14 100644
--- a/Makefile
+++ b/Makefile
@@ -6,14 +6,14 @@ LIBRARY_NAME = jackx
# add your .c source files, one object per file, to the SOURCES
# variable, help files will be included automatically, and for GUI
# objects, the matching .tcl file too
-SOURCES = jackx.c
+SOURCES = jack-connect.c jack-ports.c
# list all pd objects (i.e. myobject.pd) files here, and their helpfiles will
# be included automatically
PDOBJECTS =
# example patches and related files, in the 'examples' subfolder
-EXAMPLES =
+EXAMPLES = jack.pd
# manuals and related files, in the 'manual' subfolder
MANUAL =
diff --git a/README b/README.txt
index 1bef917..1bef917 100644
--- a/README
+++ b/README.txt
diff --git a/jack-connect.c b/jack-connect.c
new file mode 100644
index 0000000..d8275d6
--- /dev/null
+++ b/jack-connect.c
@@ -0,0 +1,180 @@
+/* jack utility externals for linux pd
+ * copyright 2003 Gerard van Dongen gml@xs4all.nl
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * jack-connect
+ * this can query and set the port connections on the jack system
+ */
+
+#include "libjackx.h"
+#include "m_pd.h"
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <jack/jack.h>
+
+
+static t_class *jackconnect_class;
+
+typedef struct _jackconnect
+{
+ t_object x_obj;
+ t_symbol *input_client,*input_port, *output_client,*output_port;
+ char source[128],destination[128]; //ought to be enough for most names
+ int connected;
+} t_jackconnect;
+
+static jack_client_t *jc;
+
+
+static void jackconnect_getnames(t_jackconnect *x)
+{
+ char* to = x->source;
+ to = (char*)stpcpy( to, x->output_client->s_name);
+ to = (char*)stpcpy(to,":");
+ to = (char*)stpcpy(to, x->output_port->s_name);
+ to = x->destination;
+ to = (char*)stpcpy(to, x->input_client->s_name);
+ to = (char*)stpcpy(to,":");
+ to = (char*)stpcpy(to, x->input_port->s_name);
+
+}
+
+static void jackconnect_connect(t_jackconnect *x)
+{
+ if (jc)
+ {
+ jackconnect_getnames(x);
+ logpost(x, 3, "connecting %s with %s", x->source, x->destination);
+ if (!jack_connect(jc, x->source, x->destination))
+ {
+ x->connected = 1;
+ outlet_float(x->x_obj.ob_outlet, x->connected);
+ }
+ }
+}
+
+static void jackconnect_disconnect(t_jackconnect *x)
+{
+ if (jc)
+ {
+ jackconnect_getnames(x);
+ if (!jack_disconnect(jc, x->source, x->destination))
+ {
+ x->connected = 0;
+ outlet_float(x->x_obj.ob_outlet, x->connected);
+ }
+ logpost(x, 3, "disconnecting %s with %s", x->source, x->destination);
+ }
+}
+
+static void jackconnect_toggle(t_jackconnect *x)
+{
+ if (jc)
+ {
+ jackconnect_getnames(x);
+ logpost(x, 3, "toggling connection %s with %s", x->source, x->destination);
+ if (jack_disconnect(jc, x->source, x->destination))
+ {
+ jack_connect(jc, x->source, x->destination);
+ x->connected = 1;
+ }
+ else
+ {
+ x->connected = 0;
+ }
+ outlet_float(x->x_obj.ob_outlet, x->connected);
+ }
+}
+
+static void jackconnect_query(t_jackconnect *x)
+{
+ if (jc)
+ {
+ const char **ports;
+ int n=0;
+ jackconnect_getnames(x);
+ logpost(x, 3, "querying connection %s with %s", x->source, x->destination);
+
+ ports = jack_port_get_all_connections(jc,(jack_port_t *)jack_port_by_name(jc, x->source));
+ x->connected = 0;
+
+ if(ports)
+ {
+ while (ports[n])
+ {
+ logpost(x, 4, "n = %i", n);
+ if (!strcmp(ports[n], x->destination))
+ {
+ x->connected = 1;
+ break;
+ }
+ n++;
+
+ }
+ free(ports);
+ }
+ outlet_float(x->x_obj.ob_outlet, x->connected);
+ }
+}
+
+static void *jackconnect_new(void)
+{
+ t_jackconnect * x = (t_jackconnect *)pd_new(jackconnect_class);
+
+ outlet_new(&x->x_obj, &s_float);
+ symbolinlet_new(&x->x_obj, &x->output_client);
+ symbolinlet_new(&x->x_obj, &x->output_port);
+ symbolinlet_new(&x->x_obj, &x->input_client);
+ symbolinlet_new(&x->x_obj, &x->input_port);
+
+ /* to prevent segfaults put default names in the client/port variables */
+ x->input_client = gensym("none");
+ x->input_port = gensym("none");
+ x->output_client = gensym("none");
+ x->output_port = gensym("none");
+ x->connected = 0;
+ jackconnect_getnames(x);
+
+ return (void*)x;
+}
+
+static void setup(void)
+{
+ jc = jackx_get_jack_client();
+
+ jackconnect_class = class_new(gensym("jack-connect"),
+ (t_newmethod)jackconnect_new,
+ 0,
+ sizeof(t_jackconnect),
+ CLASS_DEFAULT,
+ 0);
+
+ class_addmethod(jackconnect_class, (t_method)jackconnect_connect, gensym("connect"),0);
+ class_addmethod(jackconnect_class, (t_method)jackconnect_disconnect, gensym("disconnect"),0);
+ class_addmethod(jackconnect_class, (t_method)jackconnect_toggle, gensym("toggle"),0);
+ class_addmethod(jackconnect_class, (t_method)jackconnect_query, gensym("query"),0);
+ class_addbang(jackconnect_class, (t_method)jackconnect_toggle);
+}
+
+void setup_jack0x2dconnect(void)
+{
+ setup();
+}
diff --git a/jack-ports.c b/jack-ports.c
new file mode 100644
index 0000000..68c245b
--- /dev/null
+++ b/jack-ports.c
@@ -0,0 +1,233 @@
+/* jack utility externals for linux pd
+ * copyright 2003 Gerard van Dongen gml@xs4all.nl
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * jack-ports
+ * this can query jack ports with regex's
+ */
+
+
+#include "libjackx.h"
+#include "m_pd.h"
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <jack/jack.h>
+
+
+static t_class *jackports_class;
+
+typedef struct _jackports
+{
+ t_object x_obj;
+ t_outlet *input_ports, *output_ports;
+ char expression[128];
+ char *buffer; //used internally it doesn't have to be reserved every time
+ t_atom *a_outlist;
+
+} t_jackports;
+
+static jack_client_t * jc;
+
+
+static void jackports_input(t_jackports *x, t_symbol *s,int argc, t_atom *argv)
+{
+ if (jc)
+ {
+ const char ** ports;
+
+ int l = 0;
+ int n = 0;
+ int keyflag = 0;
+ int expflag =0;
+ int portflags = 0;
+ t_symbol *s_client;
+ t_symbol *s_port;
+ char *t;
+
+ if (!strcmp(s->s_name,"bang"))
+ {
+ strcpy(x->expression,"");
+ expflag = 1;
+ }
+ else
+ {
+
+ //parse symbol s and all arguments for keywords:
+ //physical,virtual,input and output
+
+ if (!strcmp(s->s_name,"physical"))
+ {
+ portflags = portflags | JackPortIsPhysical;
+ keyflag = 1;
+ }
+ if (!strcmp(s->s_name,"virtual"))
+ {
+ portflags = portflags & (~JackPortIsPhysical);
+ keyflag = 1;
+ }
+ if (!strcmp(s->s_name,"input"))
+ {
+ portflags = portflags | JackPortIsInput;
+ keyflag = 1;
+ }
+
+ if (!strcmp(s->s_name,"output"))
+ {
+ portflags = portflags | JackPortIsOutput;
+ keyflag = 1;
+ }
+ if (!keyflag)
+ {
+ strcpy(x->expression,s->s_name);
+ expflag = 1;
+ }
+ for (n=0; n<argc; n++)
+ {
+ keyflag = 0;
+ atom_string(argv+n, x->buffer,128);
+ if (!strcmp(x->buffer,"physical"))
+ {
+ portflags = portflags | JackPortIsPhysical;
+ keyflag = 1;
+ }
+ if (!strcmp(x->buffer,"virtual"))
+ {
+ portflags = portflags & (~JackPortIsPhysical);
+ keyflag = 1;
+ }
+ if (!strcmp(x->buffer,"input"))
+ {
+ portflags = portflags | JackPortIsInput;
+ keyflag = 1;
+ }
+
+ if (!strcmp(x->buffer,"output"))
+ {
+ portflags = portflags | JackPortIsOutput;
+ keyflag = 1;
+ }
+ if (!keyflag && !expflag)
+ {
+ strcpy(x->expression, x->buffer);
+ expflag = 1;
+ }
+
+
+ }
+
+
+ }
+
+
+ ports = jack_get_ports (jc, x->expression,NULL,portflags|JackPortIsOutput);
+ n=0;
+ if (ports)
+ {
+ while (ports[n])
+ {
+ //seperate port and client
+
+ l = strlen(ports[n]);
+ t = strchr(ports[n],':');
+
+ if (t)
+ {
+ s_port=gensym(strchr(ports[n],':')+1);
+
+
+ snprintf(x->buffer,l-strlen(s_port->s_name),ports[n]);
+ s_client = gensym(x->buffer);
+
+ SETSYMBOL(x->a_outlist,s_client);
+ SETSYMBOL(x->a_outlist+1,s_port);
+
+ // output in output-outlet
+ outlet_list(x->output_ports,&s_list,2, x->a_outlist);
+ }
+
+ n++;
+ }
+ }
+ free(ports);
+
+ ports = jack_get_ports (jc, x->expression,NULL,portflags|JackPortIsInput);
+ n=0;
+ if (ports)
+ {
+ while (ports[n])
+ {
+ l = strlen(ports[n]);
+ t = strchr(ports[n],':');
+
+ if (t)
+ {
+ s_port=gensym(strchr(ports[n],':')+1);
+
+
+ snprintf(x->buffer,l-strlen(s_port->s_name),ports[n]);
+ s_client = gensym(x->buffer);
+
+ SETSYMBOL(x->a_outlist,s_client);
+ SETSYMBOL(x->a_outlist+1,s_port);
+
+ // output in output-outlet
+ outlet_list(x->input_ports,&s_list,2, x->a_outlist);
+ }
+
+
+ n++;
+ }
+ }
+ free(ports);
+
+ strcpy(x->expression,"");//reset regex
+ }
+
+}
+
+static void *jackports_new(void)
+{
+ t_jackports * x = (t_jackports *)pd_new(jackports_class);
+ x->output_ports = outlet_new(&x->x_obj, &s_list);
+ x->input_ports = outlet_new(&x->x_obj, &s_list);
+ x->a_outlist = getbytes(3 * sizeof(t_atom));
+ x->buffer = getbytes(128);
+
+ return (void*)x;
+}
+
+static void setup(void)
+{
+ jc = jackx_get_jack_client();
+
+ jackports_class = class_new(gensym("jack-ports"),
+ (t_newmethod)jackports_new,
+ 0,
+ sizeof(t_jackports),
+ CLASS_DEFAULT,
+ 0);
+ class_addanything(jackports_class, jackports_input);
+}
+
+void setup_jack0x2dports(void)
+{
+ setup();
+}
diff --git a/jackx-meta.pd b/jackx-meta.pd
index 89a0bf3..b2bd874 100644
--- a/jackx-meta.pd
+++ b/jackx-meta.pd
@@ -2,6 +2,6 @@
#N canvas 25 49 420 300 META 1;
#X text 13 41 NAME jackx;
#X text 10 25 AUTHOR Gerard van Dongen;
-#X text 10 10 VERSION 0.0;
+#X text 10 10 VERSION 0.1;
#X text 10 60 LICENSE GPL;
#X restore 10 10 pd META;
diff --git a/jackx.c b/jackx.c
deleted file mode 100644
index 75042ce..0000000
--- a/jackx.c
+++ /dev/null
@@ -1,399 +0,0 @@
-/* jack utility externals for linux pd
- * copyright 2003 Gerard van Dongen gml@xs4all.nl
-
-* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-
-
-* objects:
-* jack-connect
-* this can query and set the port connections on the jack system
-* methods:
-* jack-ports
-* this can query jack ports with regex's
-
-
-
-
- */
-
-
-
-
-#include "m_pd.h"
-
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/ioctl.h>
-#include <jack/jack.h>
-
-
-static t_class *jackports_class;
-static t_class *jackconnect_class;
-
-typedef struct _jackports {
- t_object x_obj;
- t_outlet *input_ports, *output_ports;
- char expression[128];
- char *buffer; //used internally it doesn't have to be reserved every time
- t_atom *a_outlist;
-
-} t_jackports;
-
-typedef struct _jackconnect {
- t_object x_obj;
- t_symbol *input_client,*input_port, *output_client,*output_port;
- char source[128],destination[128]; //ought to be enough for most names
- int connected;
-} t_jackconnect;
-
-static jack_client_t * jc;
-
-
-
-/********************************************************************************************************
-
-methods for jack-ports
-
-*********************************************************************************************************/
-
-void jackports_input(t_jackports *x, t_symbol *s,int argc, t_atom *argv)
-{
- if (jc){
- const char ** ports;
-
- int l = 0;
- int n = 0;
- int keyflag = 0;
- int expflag =0;
- int portflags = 0;
- t_symbol *s_client;
- t_symbol *s_port;
- char *t;
-
- if (!strcmp(s->s_name,"bang")) {
- strcpy(x->expression,"");
- expflag = 1;
- } else {
-
- //parse symbol s and all arguments for keywords:
- //physical,virtual,input and output
-
- if (!strcmp(s->s_name,"physical")) {
- portflags = portflags | JackPortIsPhysical;
- keyflag = 1;
- }
- if (!strcmp(s->s_name,"virtual")) {
- portflags = portflags & (~JackPortIsPhysical);
- keyflag = 1;
- }
- if (!strcmp(s->s_name,"input")) {
- portflags = portflags | JackPortIsInput;
- keyflag = 1;
- }
-
- if (!strcmp(s->s_name,"output")) {
- portflags = portflags | JackPortIsOutput;
- keyflag = 1;
- }
- if (!keyflag) {
- strcpy(x->expression,s->s_name);
- expflag = 1;
- }
- for (n=0;n<argc;n++) {
- keyflag = 0;
- atom_string(argv+n,x->buffer,128);
- if (!strcmp(x->buffer,"physical")) {
- portflags = portflags | JackPortIsPhysical;
- keyflag = 1;
- }
- if (!strcmp(x->buffer,"virtual")) {
- portflags = portflags & (~JackPortIsPhysical);
- keyflag = 1;
- }
- if (!strcmp(x->buffer,"input")) {
- portflags = portflags | JackPortIsInput;
- keyflag = 1;
- }
-
- if (!strcmp(x->buffer,"output")) {
- portflags = portflags | JackPortIsOutput;
- keyflag = 1;
- }
- if (!keyflag && !expflag) {
- strcpy(x->expression,x->buffer);
- expflag = 1;
- }
-
-
- }
-
-
- }
-
-
- ports = jack_get_ports (jc,x->expression,NULL,portflags|JackPortIsOutput);
- n=0;
- if (ports) {
- while (ports[n]) {
- //seperate port and client
-
- l = strlen(ports[n]);
- t = strchr(ports[n],':');
-
- if (t) {
- s_port=gensym(strchr(ports[n],':')+1);
-
-
- snprintf(x->buffer,l-strlen(s_port->s_name),ports[n]);
- s_client = gensym(x->buffer);
-
- SETSYMBOL(x->a_outlist,s_client);
- SETSYMBOL(x->a_outlist+1,s_port);
-
- // output in output-outlet
- outlet_list(x->output_ports,&s_list,2,x->a_outlist);
- }
-
- n++;
- }
- }
- free(ports);
-
- ports = jack_get_ports (jc,x->expression,NULL,portflags|JackPortIsInput);
- n=0;
- if (ports) {
- while (ports[n]) {
- l = strlen(ports[n]);
- t = strchr(ports[n],':');
-
- if (t) {
- s_port=gensym(strchr(ports[n],':')+1);
-
-
- snprintf(x->buffer,l-strlen(s_port->s_name),ports[n]);
- s_client = gensym(x->buffer);
-
- SETSYMBOL(x->a_outlist,s_client);
- SETSYMBOL(x->a_outlist+1,s_port);
-
- // output in output-outlet
- outlet_list(x->input_ports,&s_list,2,x->a_outlist);
- }
-
-
- n++;
- }
- }
- free(ports);
-
- strcpy(x->expression,"");//reset regex
- }
-
-}
-
-
-
-
-void *jackports_new(void)
-{
- t_jackports * x = (t_jackports *)pd_new(jackports_class);
- x->output_ports = outlet_new(&x->x_obj, &s_list);
- x->input_ports = outlet_new(&x->x_obj, &s_list);
- x->a_outlist = getbytes(3 * sizeof(t_atom));
- x->buffer = getbytes(128);
-
- return (void*)x;
-}
-
-
-
-/********************************************************************************************************
-
-methods for jack-connect
-
-*********************************************************************************************************/
-void jackconnect_getnames(t_jackconnect *x)
-{
- char* to = x->source;
- to = (char*)stpcpy( to,x->output_client->s_name);
- to = (char*)stpcpy(to,":");
- to = (char*)stpcpy(to,x->output_port->s_name);
- to = x->destination;
- to = (char*)stpcpy(to,x->input_client->s_name);
- to = (char*)stpcpy(to,":");
- to = (char*)stpcpy(to,x->input_port->s_name);
-
-}
-void jackconnect_connect(t_jackconnect *x)
-{
-
- if (jc) {
-
- jackconnect_getnames(x);
- post("connecting %s with %s",x->source,x->destination);
- if (!jack_connect(jc,x->source,x->destination)) {
- x->connected = 1;
- outlet_float(x->x_obj.ob_outlet,x->connected);
- }
- }
-
-}
-
-void jackconnect_disconnect(t_jackconnect *x)
-{
- if (jc) {
-
- jackconnect_getnames(x);
- if (!jack_disconnect(jc,x->source,x->destination)) {
- x->connected = 0;
- outlet_float(x->x_obj.ob_outlet,x->connected);
- }
- post("disconnecting %s with %s",x->source,x->destination);
- }
-
-}
-
-void jackconnect_toggle(t_jackconnect *x)
-{
- if (jc) {
-
- jackconnect_getnames(x);
- post("toggling connection %s with %s",x->source,x->destination);
- if (jack_disconnect(jc,x->source,x->destination)) {
- jack_connect(jc,x->source,x->destination);
- x->connected = 1;
- } else {
- x->connected = 0;
- }
- outlet_float(x->x_obj.ob_outlet,x->connected);
- }
-}
-
-
-void jackconnect_query(t_jackconnect *x)
-{
- if (jc) {
-
- const char **ports;
- int n=0;
- jackconnect_getnames(x);
-
- post("querying connection %s with %s",x->source,x->destination);
-
- ports = jack_port_get_all_connections(jc,(jack_port_t *)jack_port_by_name(jc,x->source));
- x->connected = 0;
-
- if(ports){
- while (ports[n]){
- post("n = %i",n);
- if (!strcmp(ports[n],x->destination)){
- x->connected = 1;
- break;
- }
- n++;
-
- }
- free(ports);
- }
- outlet_float(x->x_obj.ob_outlet,x->connected);
- }
-
-
-
-}
-
-
-
-
-
-
-
-void *jackconnect_new(void)
-{
- t_jackconnect * x = (t_jackconnect *)pd_new(jackconnect_class);
-
- outlet_new(&x->x_obj, &s_float);
- symbolinlet_new(&x->x_obj,&x->output_client);
- symbolinlet_new(&x->x_obj,&x->output_port);
- symbolinlet_new(&x->x_obj,&x->input_client);
- symbolinlet_new(&x->x_obj,&x->input_port);
-
- /* to prevent segfaults put default names in the client/port variables */
- x->input_client = gensym("none");
- x->input_port = gensym("none");
- x->output_client = gensym("none");
- x->output_port = gensym("none");
- x->connected = 0;
- jackconnect_getnames(x);
-
- return (void*)x;
-}
-
-
-/********************************************************************************************************
-
-setup for jack-connect and jack-ports
-
-*********************************************************************************************************/
-
-
-
-void jackx_setup(void)
-{
-
- post("//////////////////////////////////////////\n"
- "/////Jack utility external library///////\n"
- "////Gerard van Dongen, gml@xs4all.nl////\n"
- "///testing for jack////////////////////\n"
- "//////////////////////////////////////");
-
-
- jc = jack_client_new("jacky-x");
-
-
-
-
- /*jack ports setup */
-
- jackports_class = class_new(gensym("jack-ports"),(t_newmethod)jackports_new,0,sizeof(t_jackports),CLASS_DEFAULT,0);
-
-
-
-
- class_addanything(jackports_class,jackports_input);
-
- class_sethelpsymbol(jackports_class,gensym("jack-ports"));
-
- /*jack-connect setup */
-
-
-
- jackconnect_class = class_new(gensym("jack-connect"),(t_newmethod)jackconnect_new,0,sizeof(t_jackconnect),CLASS_DEFAULT,0);
-
- class_addmethod(jackconnect_class, (t_method)jackconnect_connect, gensym("connect"),0);
- class_addmethod(jackconnect_class, (t_method)jackconnect_disconnect, gensym("disconnect"),0);
- class_addmethod(jackconnect_class, (t_method)jackconnect_toggle, gensym("toggle"),0);
- class_addmethod(jackconnect_class, (t_method)jackconnect_query, gensym("query"),0);
- class_addbang(jackconnect_class, (t_method)jackconnect_toggle);
- class_sethelpsymbol(jackports_class,gensym("jack-connect"));
-}
-
-
-
-
diff --git a/libjackx.c b/libjackx.c
new file mode 100644
index 0000000..05a5891
--- /dev/null
+++ b/libjackx.c
@@ -0,0 +1,30 @@
+/* jack utility externals for linux pd
+ * copyright 2003 Gerard van Dongen gml@xs4all.nl
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ * This provides a function to make sure all instances of jackx
+ * objects are using the same jack connection.
+
+ */
+
+#include <jack/jack.h>
+
+static jack_client_t *jc;
+
+jack_client_t * jackx_get_jack_client()
+{
+ if (!jc)
+ jc = jack_client_new("jacky-x");
+ return jc;
+}
diff --git a/libjackx.h b/libjackx.h
new file mode 100644
index 0000000..e1d6ea0
--- /dev/null
+++ b/libjackx.h
@@ -0,0 +1,22 @@
+/* jack utility externals for linux pd
+ * copyright 2003 Gerard van Dongen gml@xs4all.nl
+ *
+ * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * this provides a function to make sure all instances of jackx objects
+ * are using the same jack connection.
+ */
+
+#include <jack/jack.h>
+
+jack_client_t * jackx_get_jack_client();