diff options
author | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2007-01-02 01:38:20 +0000 |
---|---|---|
committer | Hans-Christoph Steiner <eighthave@users.sourceforge.net> | 2007-01-02 01:38:20 +0000 |
commit | 90d9f039bc67f902dcb0525354b65b58c540bd2d (patch) | |
tree | de26e87ccb8d31e396cc91b67cb314565a03b2a5 /src/sendOSC.c | |
parent | c856bf200f64502de6dc77d24f96040a4e42c7fe (diff) |
committed patch 1612910 to add multicast support to the OSCx objects. I took
out the changes to configure.ac since it broke the Pd-extended build stuff.
svn path=/trunk/externals/OSCx/; revision=7120
Diffstat (limited to 'src/sendOSC.c')
-rw-r--r-- | src/sendOSC.c | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/src/sendOSC.c b/src/sendOSC.c index 10c22c9..3c99402 100644 --- a/src/sendOSC.c +++ b/src/sendOSC.c @@ -113,7 +113,7 @@ static void *sendOSC_new(t_floatarg udpflag); void sendOSC_openbundle(t_sendOSC *x);
static void sendOSC_closebundle(t_sendOSC *x);
static void sendOSC_settypetags(t_sendOSC *x, t_float *f);
-static void sendOSC_connect(t_sendOSC *x, t_symbol *hostname, t_floatarg fportno);
+static void sendOSC_connect(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv);
void sendOSC_disconnect(t_sendOSC *x);
static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv);
void sendOSC_send(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv);
@@ -187,16 +187,39 @@ static void sendOSC_settypetags(t_sendOSC *x, t_float *f) post("sendOSC.c: setting typetags %d",x->x_typetags);
}
-static void sendOSC_connect(t_sendOSC *x, t_symbol *hostname, t_floatarg fportno)
+static void sendOSC_connect(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) // t_symbol *hostname, t_floatarg fportno, int argc, t_atom *argv)
{
- int portno = fportno;
+ float fportno=0;
+ t_symbol *hostname;
+ int portno = fportno;
+ unsigned char ttl=1;
char *protocolStr;
- /* create a socket */
+ /* create a socket */
+
+ if (argc < 2)
+ return;
+
+ if (argv[0].a_type==A_SYMBOL)
+ hostname = argv[0].a_w.w_symbol;
+ else
+ return;
+
+ if (argv[1].a_type==A_FLOAT)
+ portno = (int)argv[1].a_w.w_float;
+ else
+ return;
+
+ if (argc >= 3) {
+ if (argv[2].a_type==A_FLOAT)
+ ttl = (unsigned char)argv[2].a_w.w_float;
+ else
+ return;
+ }
// make sure handle is available
if(x->x_htmsocket == 0)
{
- x->x_htmsocket = OpenHTMSocket(hostname->s_name, portno);
+ x->x_htmsocket = OpenHTMSocket(hostname->s_name, portno, ttl);
if (!x->x_htmsocket)
post("sendOSC: Couldn't open socket: ");
else
@@ -213,8 +236,8 @@ static void sendOSC_connect(t_sendOSC *x, t_symbol *hostname, t_floatarg fportno protocolStr = "unknown";
break;
}
- post("sendOSC: connected to port %s:%d (hSock=%d) protocol = %s",
- hostname->s_name, portno, x->x_htmsocket, protocolStr);
+ post("sendOSC: connected to port %s:%d (hSock=%d) protocol = %s ttl = %d",
+ hostname->s_name, portno, x->x_htmsocket, protocolStr, ttl);
outlet_float(x->x_obj.ob_outlet, 1);
}
}
@@ -337,7 +360,7 @@ void sendOSC_setup(void) (t_method)sendOSC_free,
sizeof(t_sendOSC), 0, A_DEFFLOAT, 0);
class_addmethod(sendOSC_class, (t_method)sendOSC_connect,
- gensym("connect"), A_SYMBOL, A_FLOAT, 0);
+ gensym("connect"), A_GIMME, 0);
class_addmethod(sendOSC_class, (t_method)sendOSC_disconnect,
gensym("disconnect"), 0);
class_addmethod(sendOSC_class, (t_method)sendOSC_settypetags,
|