[PD-cvs] externals/mrpeach/osc packOSC.c, 1.5, 1.6 unpackOSC.c, 1.2, 1.3 routeOSC-help.pd, 1.1, 1.2 packOSC-help.pd, 1.5, 1.6
Martin Peach
mrpeach at users.sourceforge.net
Thu Jul 5 21:08:56 CEST 2007
Update of /cvsroot/pure-data/externals/mrpeach/osc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3740
Modified Files:
packOSC.c unpackOSC.c routeOSC-help.pd packOSC-help.pd
Log Message:
Added some support for time tags: immediate or current time plus optional offset.
Index: packOSC.c
===================================================================
RCS file: /cvsroot/pure-data/externals/mrpeach/osc/packOSC.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** packOSC.c 20 Jun 2007 20:28:05 -0000 1.5
--- packOSC.c 5 Jul 2007 19:08:53 -0000 1.6
***************
*** 38,41 ****
--- 38,42 ----
#include <string.h>
#include <stdlib.h>
+ #include <sys/time.h>
#ifdef MSW
***************
*** 103,106 ****
--- 104,110 ----
that it should process the message immediately. */
static OSCTimeTag OSCTT_Immediately(void);
+ static OSCTimeTag OSCTT_Infinite(void);
+
+ static OSCTimeTag OSCTT_CurrentTimePlusOffset(uint4 offset);
/* The int4byte type has to be a 4-byte integer. You may have to
***************
*** 240,243 ****
--- 244,248 ----
t_object x_obj;
t_int x_typetags; /* typetag flag */
+ t_int x_timeTagOffset;
int x_bundle; /* bundle open flag */
OSCbuf x_oscbuf[1]; /* OSCbuffer */
***************
*** 250,254 ****
} t_packOSC;
! static void *packOSC_new(t_floatarg udpflag);
static void packOSC_path(t_packOSC *x, t_symbol*s);
static void packOSC_openbundle(t_packOSC *x);
--- 255,259 ----
} t_packOSC;
! static void *packOSC_new(void);
static void packOSC_path(t_packOSC *x, t_symbol*s);
static void packOSC_openbundle(t_packOSC *x);
***************
*** 256,259 ****
--- 261,265 ----
static void packOSC_settypetags(t_packOSC *x, t_floatarg f);
static void packOSC_setbufsize(t_packOSC *x, t_floatarg f);
+ static void packOSC_setTimeTagOffset(t_packOSC *x, t_floatarg f);
static void packOSC_sendtyped(t_packOSC *x, t_symbol *s, int argc, t_atom *argv);
static void packOSC_send_type_forced(t_packOSC *x, t_symbol *s, int argc, t_atom *argv);
***************
*** 268,272 ****
static void packOSC_sendbuffer(t_packOSC *x);
! static void *packOSC_new(t_floatarg udpflag)
{
t_packOSC *x = (t_packOSC *)pd_new(packOSC_class);
--- 274,278 ----
static void packOSC_sendbuffer(t_packOSC *x);
! static void *packOSC_new(void)
{
t_packOSC *x = (t_packOSC *)pd_new(packOSC_class);
***************
*** 284,287 ****
--- 290,294 ----
x->x_listout = outlet_new(&x->x_obj, &s_list);
x->x_bdpthout = outlet_new(&x->x_obj, &s_float);
+ x->x_timeTagOffset = -1; /* immediately */
return (x);
}
***************
*** 305,314 ****
static void packOSC_openbundle(t_packOSC *x)
{
! if (x->x_oscbuf->bundleDepth + 1 >= MAX_BUNDLE_NESTING ||
! OSC_openBundle(x->x_oscbuf, OSCTT_Immediately()))
! {
! post("packOSC: Problem opening bundle.");
! return;
! }
x->x_bundle = 1;
outlet_float(x->x_bdpthout, (float)x->x_oscbuf->bundleDepth);
--- 312,321 ----
static void packOSC_openbundle(t_packOSC *x)
{
! int result;
! if (x->x_timeTagOffset == -1)
! result = OSC_openBundle(x->x_oscbuf, OSCTT_Immediately());
! else
! result = OSC_openBundle(x->x_oscbuf, OSCTT_CurrentTimePlusOffset((uint4)x->x_timeTagOffset));
! if (result != 0) return;
x->x_bundle = 1;
outlet_float(x->x_bdpthout, (float)x->x_oscbuf->bundleDepth);
***************
*** 356,359 ****
--- 363,370 ----
+ static void packOSC_setTimeTagOffset(t_packOSC *x, t_floatarg f)
+ {
+ x->x_timeTagOffset = (t_int)f;
+ }
/* this is the real and only sending routine now, for both typed and */
/* undtyped mode. */
***************
*** 531,534 ****
--- 542,547 ----
class_addmethod(packOSC_class, (t_method)packOSC_setbufsize,
gensym("bufsize"), A_DEFFLOAT, 0);
+ class_addmethod(packOSC_class, (t_method)packOSC_setTimeTagOffset,
+ gensym("timetagoffset"), A_DEFFLOAT, 0);
class_addmethod(packOSC_class, (t_method)packOSC_send,
gensym("send"), A_GIMME, 0);
***************
*** 1241,1243 ****
--- 1254,1293 ----
return tt;
}
+
+ static OSCTimeTag OSCTT_Infinite(void)
+ {
+ OSCTimeTag tt;
+ tt.fraction = 0xffffffffL;
+ tt.seconds = 0xffffffffL;
+ return tt;
+ }
+
+ #define SECONDS_FROM_1900_to_1970 2208988800LL /* 17 leap years */
+ #define TWO_TO_THE_32_OVER_ONE_MILLION 4295LL
+
+ static OSCTimeTag OSCTT_CurrentTimePlusOffset(uint4 offset)
+ { /* offset is in microseconds */
+ OSCTimeTag tt;
+ struct timeval tv;
+ struct timezone tz;
+ static unsigned int onemillion = 1000000;
+
+ gettimeofday(&tv, &tz);
+
+ /* First get the seconds right */
+ tt.seconds = (unsigned) SECONDS_FROM_1900_to_1970 +
+ (unsigned) tv.tv_sec -
+ (unsigned) 60 * tz.tz_minuteswest +
+ (unsigned) (tz.tz_dsttime ? 3600 : 0)+
+ (unsigned) offset/onemillion;
+ /* Now get the fractional part. */
+ tt.fraction = ((unsigned) tv.tv_usec + (unsigned)(offset%onemillion)) * (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION;
+ if (tt.fraction > onemillion)
+ {
+ tt.fraction -= onemillion;
+ tt.seconds++;
+ }
+ return tt;
+ }
+
/* end packOSC.c*/
Index: packOSC-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/mrpeach/osc/packOSC-help.pd,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** packOSC-help.pd 20 Jun 2007 21:15:05 -0000 1.5
--- packOSC-help.pd 5 Jul 2007 19:08:53 -0000 1.6
***************
*** 1,46 ****
! #N canvas 306 39 997 661 12;
! #X obj 72 541 udpsend;
! #X msg 136 486 disconnect;
! #X msg 136 457 connect 127.0.0.1 9997;
#X obj 72 296 packOSC;
! #X obj 72 576 tgl 15 0 empty empty 1=connected 20 8 0 8 -262144 -1
-1 1 1;
#X msg 3 3 send /test/one/two/three zz 88 T;
#X msg 54 54 send /test 1 2 3;
! #X msg 31 29 send /west 35;
! #X msg 72 82 send /*/left 22;
! #X msg 87 109 send /?est/ 1;
#X text 140 288 packOSC is like sendOSC except that it outputs a list
of floats instead of directly connecting to the network;
#X text 299 2 send a type-guessed message;
! #X text 381 183 send a type-forced message;
! #X obj 420 69 routeOSC;
! #X text 341 69 see also:;
#X msg 121 264 typetags \$1;
#X obj 121 247 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 228 264 typetags are on by default;
! #X text 638 135 Useable types are:;
! #X text 638 153 i: 32 bit integer;
! #X text 638 171 f: 32-bit float;
! #X text 638 189 s: string;
! #X text 539 28 send a type-forced message;
#X msg 164 27 sendtyped /test/one/two/three sis zz 88 T;
#X msg 112 202 sendtyped /left/right TTiTIFNfisf 1.1 2.1 3.1 4.1 5.1
;
! #X text 638 207 T: true (no argument);
! #X text 638 225 F: false (no argument);
! #X text 638 243 I: infinitum (no argument);
! #X obj 72 408 list prepend send;
! #X obj 72 434 list trim;
! #X text 638 260 N: Nil (no argument);
#X msg 115 225 bufsize 100;
#X text 221 226 set buffer size (default is 64000 bytes);
! #X msg 267 105 prefix /test;
! #X text 384 106 set the OSC path prefix for subsequent messages;
! #X msg 112 161 /left one two;
! #X msg 100 135 /right 88;
! #X text 191 136 'send' prefix is not required;
! #X text 462 529 2007/06/20 Martin Peach;
#X connect 0 0 4 0;
#X connect 1 0 0 0;
--- 1,59 ----
! #N canvas 0 366 1064 453 12;
! #X obj 72 393 udpsend;
! #X msg 373 359 disconnect;
! #X msg 161 359 connect 127.0.0.1 9997;
#X obj 72 296 packOSC;
! #X obj 72 428 tgl 15 0 empty empty 1=connected 20 8 0 8 -262144 -1
-1 1 1;
#X msg 3 3 send /test/one/two/three zz 88 T;
#X msg 54 54 send /test 1 2 3;
! #X msg 30 27 send /west 35;
! #X msg 212 54 send /*/left 22;
! #X msg 360 54 send /?est/ 1;
#X text 140 288 packOSC is like sendOSC except that it outputs a list
of floats instead of directly connecting to the network;
#X text 299 2 send a type-guessed message;
! #X text 596 201 send a type-forced message;
! #X obj 652 417 routeOSC;
! #X text 573 417 see also:;
#X msg 121 264 typetags \$1;
#X obj 121 247 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1;
#X text 228 264 typetags are on by default;
! #X text 670 223 Useable types are:;
! #X text 670 241 i: 32 bit integer;
! #X text 670 259 f: 32-bit float;
! #X text 670 277 s: string;
! #X text 539 26 send a type-forced message;
#X msg 164 27 sendtyped /test/one/two/three sis zz 88 T;
#X msg 112 202 sendtyped /left/right TTiTIFNfisf 1.1 2.1 3.1 4.1 5.1
;
! #X text 670 295 T: true (no argument);
! #X text 670 313 F: false (no argument);
! #X text 670 331 I: infinitum (no argument);
! #X obj 72 323 list prepend send;
! #X obj 72 349 list trim;
! #X text 670 348 N: Nil (no argument);
#X msg 115 225 bufsize 100;
#X text 221 226 set buffer size (default is 64000 bytes);
! #X msg 83 84 prefix /test;
! #X text 200 83 set the OSC path prefix for subsequent messages;
! #X msg 106 178 /left one two;
! #X msg 98 157 /right 88;
! #X text 189 156 'send' prefix is not required;
! #X msg -37 105 [;
! #X msg -95 129 ];
! #X text 270 421 2007/07/05 Martin Peach;
! #X text 8 104 open a bundle;
! #X text -55 128 close bundle;
! #X msg 457 111 timetagoffset 0;
! #X msg 464 130 timetagoffset -1;
! #X text 602 110 send current time as timetag;
! #X msg 472 149 timetagoffset 1e+07;
! #X text 494 169 (timetags are sent in bundle messages only);
! #X text 680 148 current time plus 10 seconds;
! #X obj -95 71 t b a b;
! #X msg -95 48 /test 5 6 7;
! #X text 615 129 immediate time tag (default);
#X connect 0 0 4 0;
#X connect 1 0 0 0;
***************
*** 62,63 ****
--- 75,85 ----
#X connect 35 0 3 0;
#X connect 36 0 3 0;
+ #X connect 38 0 3 0;
+ #X connect 39 0 3 0;
+ #X connect 43 0 3 0;
+ #X connect 44 0 3 0;
+ #X connect 46 0 3 0;
+ #X connect 49 0 39 0;
+ #X connect 49 1 3 0;
+ #X connect 49 2 38 0;
+ #X connect 50 0 49 0;
Index: routeOSC-help.pd
===================================================================
RCS file: /cvsroot/pure-data/externals/mrpeach/osc/routeOSC-help.pd,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** routeOSC-help.pd 16 Aug 2006 20:22:22 -0000 1.1
--- routeOSC-help.pd 5 Jul 2007 19:08:53 -0000 1.2
***************
*** 1,35 ****
! #N canvas 0 0 574 322 12;
! #X obj 58 82 udpreceive 9997;
! #X obj 173 106 unpack 0 0 0 0;
! #X floatatom 173 129 3 0 0 0 - - -;
! #X floatatom 208 129 3 0 0 0 - - -;
! #X floatatom 244 129 3 0 0 0 - - -;
! #X floatatom 280 129 3 0 0 0 - - -;
! #X text 137 128 from;
! #X obj 58 114 unpackOSC;
! #X obj 56 158 print;
! #X obj 70 206 routeOSC /test /west;
! #X obj 70 241 print a;
! #X obj 147 241 print b;
! #X obj 225 241 print c;
! #X msg 203 171 set /left;
! #X msg 294 171 set /left /right;
! #X text 10 7 routeOSC;
! #X text 10 25 accepts lists of floats that are interpreted as OSC packets
! ;
! #X text 10 43 set message reassigns outputs;
! #X text 244 206 arguments are OSC addresses to route;
! #X text 296 284 2006/04/25 Martin Peach;
! #X connect 0 0 7 0;
! #X connect 0 1 1 0;
! #X connect 1 0 2 0;
! #X connect 1 1 3 0;
! #X connect 1 2 4 0;
! #X connect 1 3 5 0;
! #X connect 7 0 8 0;
! #X connect 7 0 9 0;
! #X connect 9 0 10 0;
! #X connect 9 1 11 0;
! #X connect 9 2 12 0;
! #X connect 13 0 9 0;
! #X connect 14 0 9 0;
--- 1,39 ----
! #N canvas 0 0 623 272 12;
! #X obj 58 69 udpreceive 9997;
! #X obj 188 97 unpack 0 0 0 0;
! #X floatatom 188 128 3 0 0 0 - - -;
! #X floatatom 228 128 3 0 0 0 - - -;
! #X floatatom 268 128 3 0 0 0 - - -;
! #X floatatom 309 128 3 0 0 0 - - -;
! #X text 148 127 from;
! #X obj 58 97 unpackOSC;
! #X obj 58 147 print;
! #X obj 70 206 routeOSC /test /west;
! #X obj 70 241 print a;
! #X obj 157 241 print b;
! #X obj 245 241 print c;
! #X msg 76 175 set /left;
! #X msg 193 175 set /left /right;
! #X text 10 7 routeOSC;
! #X text 10 25 accepts lists of floats that are interpreted as OSC packets
! ;
! #X text 10 43 set message reassigns outputs;
! #X text 258 205 arguments are OSC addresses to route;
! #X obj 134 147 print timetag;
! #X text 329 244 2007/07/05 Martin Peach;
! #X text 423 121 see also:;
! #X obj 502 121 packOSC;
! #X connect 0 0 7 0;
! #X connect 0 1 1 0;
! #X connect 1 0 2 0;
! #X connect 1 1 3 0;
! #X connect 1 2 4 0;
! #X connect 1 3 5 0;
! #X connect 7 0 8 0;
! #X connect 7 0 9 0;
! #X connect 7 1 19 0;
! #X connect 9 0 10 0;
! #X connect 9 1 11 0;
! #X connect 9 2 12 0;
! #X connect 13 0 9 0;
! #X connect 14 0 9 0;
Index: unpackOSC.c
===================================================================
RCS file: /cvsroot/pure-data/externals/mrpeach/osc/unpackOSC.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** unpackOSC.c 15 Feb 2007 23:09:35 -0000 1.2
--- unpackOSC.c 5 Jul 2007 19:08:53 -0000 1.3
***************
*** 5,8 ****
--- 5,9 ----
/* This version tries to be standalone from LIBOSC MP 20060425 */
/* MP 20060505 fixed a bug (line 209) where bytes are wrongly interpreted as negative */
+ /* MP 20070705 added timestamp outlet */
/* dumpOSC.c header follows: */
/*
***************
*** 34,75 ****
! /*
!
! dumpOSC.c
! server that displays OpenSoundControl messages sent to it
! for debugging client udp and UNIX protocol
! by Matt Wright, 6/3/97
! modified from dumpSC.c, by Matt Wright and Adrian Freed
! version 0.2: Added "-silent" option a.k.a. "-quiet"
! version 0.3: Incorporated patches from Nicola Bernardini to make
! things Linux-friendly. Also added ntohl() in the right places
! to support little-endian architectures.
!
! compile:
! cc -o dumpOSC dumpOSC.c
! to-do:
! More robustness in saying exactly what's wrong with ill-formed
! messages. (If they don't make sense, show exactly what was
! received.)
! Time-based features: print time-received for each packet
! Clean up to separate OSC parsing code from socket/select stuff
- pd: branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/dumpOSC/dumpOSC.c
- -------------
- -- added pd functions
- -- socket is made differently than original via pd mechanisms
- -- tweaks for Win32 www.zeggz.com/raf 13-April-2002
- -- the OSX changes from cnmat didnt make it here yet but this compiles
- on OSX anyway.
-
*/
--- 35,71 ----
! /*
! dumpOSC.c
! server that displays OpenSoundControl messages sent to it
! for debugging client udp and UNIX protocol
! by Matt Wright, 6/3/97
! modified from dumpSC.c, by Matt Wright and Adrian Freed
! version 0.2: Added "-silent" option a.k.a. "-quiet"
+ version 0.3: Incorporated patches from Nicola Bernardini to make
+ things Linux-friendly. Also added ntohl() in the right places
+ to support little-endian architectures.
! to-do:
! More robustness in saying exactly what's wrong with ill-formed
! messages. (If they don't make sense, show exactly what was
! received.)
! Time-based features: print time-received for each packet
! Clean up to separate OSC parsing code from socket/select stuff
! pd: branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/dumpOSC/dumpOSC.c
! -------------
! -- added pd functions
! -- socket is made differently than original via pd mechanisms
! -- tweaks for Win32 www.zeggz.com/raf 13-April-2002
! -- the OSX changes from cnmat didnt make it here yet but this compiles
! on OSX anyway.
*/
***************
*** 80,90 ****
#include "m_pd.h"
- /* declarations */
-
-
#ifdef _WIN32
- #ifdef _MSC_VER
- // #include "OSC-common.h"
- #endif /* _MSC_VER */
#include <string.h>
#include <stdlib.h>
--- 76,80 ----
***************
*** 92,123 ****
#include <stdio.h>
#else
! #include <stdio.h>
! #include <string.h>
! #include <stdlib.h>
! // #include <unistd.h>
! // #include <fcntl.h>
! #include <sys/types.h>
! // #include <sys/stat.h>
! #include <netinet/in.h>
! // #include <rpc/rpc.h>
! // #include <sys/socket.h>
! // #include <sys/un.h>
! // #include <sys/times.h>
! // #include <sys/param.h>
! // #include <sys/time.h>
! // #include <sys/ioctl.h>
#include <ctype.h>
- // #include <arpa/inet.h>
- // #include <netdb.h>
- // #include <pwd.h>
- // #include <signal.h>
- // #include <grp.h>
- // #include <sys/file.h>
- //#include <sys/prctl.h>
-
- // #ifdef NEED_SCHEDCTL_AND_LOCK
- // #include <sys/schedctl.h>
- // #include <sys/lock.h>
- // #endif
#endif /* _WIN32 */
--- 82,91 ----
#include <stdio.h>
#else
! #include <stdio.h>
! #include <string.h>
! #include <stdlib.h>
! #include <sys/types.h>
! #include <netinet/in.h>
#include <ctype.h>
#endif /* _WIN32 */
***************
*** 141,153 ****
t_object x_obj;
t_outlet *x_data_out;
t_atom x_data_at[MAX_MESG];// symbols making up the path + payload
int x_data_atc;// number of symbols to be output
! char x_raw[MAX_MESG];// bytes making up the entire OSC message
! int x_raw_c;// number of bytes in OSC message
} t_unpackOSC;
- #ifdef MSW
- __declspec(dllexport)
- #endif
void unpackOSC_setup(void);
static void *unpackOSC_new(void);
--- 109,120 ----
t_object x_obj;
t_outlet *x_data_out;
+ t_outlet *x_timetag_out;
+ t_atom x_timetag[4];// timetag as four floats
t_atom x_data_at[MAX_MESG];// symbols making up the path + payload
int x_data_atc;// number of symbols to be output
! char x_raw[MAX_MESG];// bytes making up the entire OSC message
! int x_raw_c;// number of bytes in OSC message
} t_unpackOSC;
void unpackOSC_setup(void);
static void *unpackOSC_new(void);
***************
*** 168,172 ****
x = (t_unpackOSC *)pd_new(unpackOSC_class);
x->x_data_out = outlet_new(&x->x_obj, &s_list);
! x->x_raw_c = x->x_data_atc = 0;
return (x);
}
--- 135,140 ----
x = (t_unpackOSC *)pd_new(unpackOSC_class);
x->x_data_out = outlet_new(&x->x_obj, &s_list);
! x->x_timetag_out = outlet_new(&x->x_obj, &s_list);
! x->x_raw_c = x->x_data_atc = 0;
return (x);
}
***************
*** 176,182 ****
}
- #ifdef MSW
- __declspec(dllexport)
- #endif
void unpackOSC_setup(void)
{
--- 144,147 ----
***************
*** 192,199 ****
int size, messageLen, i, j;
char *messageName, *args, *buf;
!
if ((argc%4) != 0)
{
! post("unpackOSC: packet size (%d) not a multiple of 4 bytes: dropping packet", argc);
return;
}
--- 157,167 ----
int size, messageLen, i, j;
char *messageName, *args, *buf;
! unsigned long timetag_s;
! unsigned long timetag_ms;
! unsigned short timetag[4];
!
if ((argc%4) != 0)
{
! post("unpackOSC: packet size (%d) not a multiple of 4 bytes: dropping packet", argc);
return;
}
***************
*** 203,222 ****
if (argv[i].a_type == A_FLOAT)
{
! j = (int)argv[i].a_w.w_float;
! // if ((j == argv[i].a_w.w_float) && (j >= 0) && (j <= 255))
// this can miss bytes between 128 and 255 because they are interpreted somewhere as negative
// , so change to this:
! if ((j == argv[i].a_w.w_float) && (j >= -128) && (j <= 255))
! {
x->x_raw[i] = (char)j;
! }
else
{
! post("unpackOSC: data out of range (%d), dropping packet", argv[i].a_w.w_float);
return;
}
}
else
! {
post("unpackOSC: data not float, dropping packet");
return;
--- 171,190 ----
if (argv[i].a_type == A_FLOAT)
{
! j = (int)argv[i].a_w.w_float;
! // if ((j == argv[i].a_w.w_float) && (j >= 0) && (j <= 255))
// this can miss bytes between 128 and 255 because they are interpreted somewhere as negative
// , so change to this:
! if ((j == argv[i].a_w.w_float) && (j >= -128) && (j <= 255))
! {
x->x_raw[i] = (char)j;
! }
else
{
! post("unpackOSC: data out of range (%d), dropping packet", argv[i].a_w.w_float);
return;
}
}
else
! {
post("unpackOSC: data not float, dropping packet");
return;
***************
*** 224,228 ****
}
x->x_raw_c = argc;
! buf = x->x_raw;
if ((argc >= 8) && (strncmp(buf, "#bundle", 8) == 0))
--- 192,196 ----
}
x->x_raw_c = argc;
! buf = x->x_raw;
if ((argc >= 8) && (strncmp(buf, "#bundle", 8) == 0))
***************
*** 243,247 ****
ntohl(*((unsigned long *)(buf+12))));
#endif
!
/* Note: if we wanted to actually use the time tag as a little-endian
64-bit int, we'd have to word-swap the two 32-bit halves of it */
--- 211,223 ----
ntohl(*((unsigned long *)(buf+12))));
#endif
! /* split the timetag into 4 16-bit fragments so we can output them as floats */
! timetag_s = ntohl(*((unsigned long *)(buf+8)));
! timetag_ms = ntohl(*((unsigned long *)(buf+12)));
! timetag[0] = (short)(timetag_s>>8);
! timetag[1] = (short)(timetag_s & 0xFFFF);
! timetag[2] = (short)(timetag_ms>>8);
! timetag[3] = (short)(timetag_ms & 0xFFFF);
! for (i = 0; i < 4; ++i) SETFLOAT(&x->x_timetag[i], (float)timetag[i]);
! outlet_list(x->x_timetag_out, &s_list, 4, x->x_timetag);
/* Note: if we wanted to actually use the time tag as a little-endian
64-bit int, we'd have to word-swap the two 32-bit halves of it */
***************
*** 271,276 ****
if (i != argc)
{
! post("unpackOSC: This can't happen");
! }
#ifdef DEBUG
printf("]\n");
--- 247,252 ----
if (i != argc)
{
! post("unpackOSC: This can't happen");
! }
#ifdef DEBUG
printf("]\n");
***************
*** 310,316 ****
int i;
! if (path[0] != '/')
{
! post("unpackOSC: bad path (%s)", path);
return 0;
}
--- 286,292 ----
int i;
! if (path[0] != '/')
{
! post("unpackOSC: bad path (%s)", path);
return 0;
}
***************
*** 357,362 ****
{
char *typeTags, *thisType, *p;
! int myargc = x->x_data_atc;
! t_atom *mya = x->x_data_at;
typeTags = v;
--- 333,338 ----
{
char *typeTags, *thisType, *p;
! int myargc = x->x_data_atc;
! t_atom *mya = x->x_data_at;
typeTags = v;
***************
*** 460,464 ****
}
}
! x->x_data_atc = myargc;
}
--- 436,440 ----
}
}
! x->x_data_atc = myargc;
}
***************
*** 469,474 ****
float thisf;
char *chars, *string, *nextString;
! int myargc= x->x_data_atc;
! t_atom* mya = x->x_data_at;
--- 445,450 ----
float thisf;
char *chars, *string, *nextString;
! int myargc= x->x_data_atc;
! t_atom* mya = x->x_data_at;
***************
*** 494,498 ****
}
else if (thisf >= -1000.f && thisf <= 1000000.f &&
! (thisf <=0.0f || thisf >= SMALLEST_POSITIVE_FLOAT))
{
#ifdef DEBUG
--- 470,474 ----
}
else if (thisf >= -1000.f && thisf <= 1000000.f &&
! (thisf <=0.0f || thisf >= SMALLEST_POSITIVE_FLOAT))
{
#ifdef DEBUG
***************
*** 517,525 ****
// unhandled .. ;)
#ifdef DEBUG
! post("unpackOSC: indeterminate type: 0x%x xx", ints[i]);
#endif
i++;
}
! x->x_data_atc = myargc;
}
}
--- 493,501 ----
// unhandled .. ;)
#ifdef DEBUG
! post("unpackOSC: indeterminate type: 0x%x xx", ints[i]);
#endif
i++;
}
! x->x_data_atc = myargc;
}
}
***************
*** 551,555 ****
if (string + i >= boundary)
{
! post("unpackOSC: DataAfterAlignedString: Unreasonably long string");
return 0;
}
--- 527,531 ----
if (string + i >= boundary)
{
! post("unpackOSC: DataAfterAlignedString: Unreasonably long string");
return 0;
}
***************
*** 563,572 ****
if (string + i >= boundary)
{
! post("unpackOSC: DataAfterAlignedString: Unreasonably long string");
return 0;
}
if (string[i] != '\0')
{
! post("unpackOSC:DataAfterAlignedString: Incorrectly padded string");
return 0;
}
--- 539,548 ----
if (string + i >= boundary)
{
! post("unpackOSC: DataAfterAlignedString: Unreasonably long string");
return 0;
}
if (string[i] != '\0')
{
! post("unpackOSC:DataAfterAlignedString: Incorrectly padded string");
return 0;
}
More information about the Pd-cvs
mailing list