diff options
-rw-r--r-- | libOSC/OSC-client.c | 46 | ||||
-rw-r--r-- | libOSC/OSC-client.c.pre-htonl | 303 | ||||
-rw-r--r-- | libOSC/OSC-client.h | 43 | ||||
-rw-r--r-- | libOSC/OSC-timetag.c | 7 | ||||
-rw-r--r-- | libOSC/OSC-timetag.h | 7 | ||||
-rw-r--r-- | src/OSC.c | 5 | ||||
-rw-r--r-- | src/OSCroute.c | 57 | ||||
-rw-r--r-- | src/dumpOSC.c | 61 | ||||
-rw-r--r-- | src/htmsocket.c | 64 | ||||
-rw-r--r-- | src/htmsocket.h | 45 | ||||
-rw-r--r-- | src/sendOSC.c | 97 |
11 files changed, 200 insertions, 535 deletions
diff --git a/libOSC/OSC-client.c b/libOSC/OSC-client.c index c85d09a..cea9e78 100644 --- a/libOSC/OSC-client.c +++ b/libOSC/OSC-client.c @@ -1,29 +1,24 @@ /*
-Copyright (c) 1996. The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
+University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03
+The Regents of the University of California (Regents).
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*/
@@ -40,6 +35,9 @@ University of California, Berkeley. raf@interaccess.com:
rev. for Win32 build (verified under Win-2ooo) 11-April-2002
+ -- changed licence part (20040820) jdl
+ -- Version 2.4 changes not in here (20040820) jdl
+
*/
/* Here are the possible values of the state field: */
diff --git a/libOSC/OSC-client.c.pre-htonl b/libOSC/OSC-client.c.pre-htonl deleted file mode 100644 index 6aebfe2..0000000 --- a/libOSC/OSC-client.c.pre-htonl +++ /dev/null @@ -1,303 +0,0 @@ -/* -Copyright (c) 1996. The Regents of the University of California (Regents). -All Rights Reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for educational, research, and not-for-profit purposes, without -fee and without a signed licensing agreement, is hereby granted, provided that -the above copyright notice, this paragraph and the following two paragraphs -appear in all copies, modifications, and distributions. Contact The Office of -Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, -CA 94720-1620, (510) 643-7201, for commercial licensing opportunities. - -Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. - - IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, - ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF - REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING - DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". - REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, - ENHANCEMENTS, OR MODIFICATIONS. -*/ - - -/* - Author: Matt Wright - Version 2.1 - */ - - -/* Here are the possible values of the state field: */ - -#define EMPTY 0 /* Nothing written to packet yet */ -#define ONE_MSG_ARGS 1 /* Packet has a single message; gathering arguments */ -#define NEED_COUNT 2 /* Just opened a bundle; must write message name or - open another bundle */ -#define GET_ARGS 3 /* Getting arguments to a message. If we see a message - name or a bundle open/close then the current message - will end. */ -#define DONE 4 /* All open bundles have been closed, so can't write - anything else */ - -#include "OSC-client.h" - -char *OSC_errorMessage; - - -static int strlen(char *s); -static int OSC_padString(char *dest, char *str); - -void OSC_initBuffer(OSCbuf *buf, int size, char *byteArray) { - buf->buffer = byteArray; - buf->size = size; - OSC_resetBuffer(buf); -} - -void OSC_resetBuffer(OSCbuf *buf) { - buf->bufptr = buf->buffer; - buf->state = EMPTY; - buf->bundleDepth = 0; - buf->prevCounts[0] = 0; -} - -int OSC_isBufferEmpty(OSCbuf *buf) { - return buf->bufptr == buf->buffer; -} - -int OSC_freeSpaceInBuffer(OSCbuf *buf) { - return buf->size - (buf->bufptr - buf->buffer); -} - -int OSC_isBufferDone(OSCbuf *buf) { - return (buf->state == DONE || buf->state == ONE_MSG_ARGS); -} - -char *OSC_getPacket(OSCbuf *buf) { -#ifdef ERROR_CHECK_GETPACKET - if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { - return buf->buffer; - } else { - OSC_errorMessage = "Packet has unterminated bundles"; - return 0; - } -#else - return buf->buffer; -#endif -} - -int OSC_packetSize(OSCbuf *buf) { -#ifdef ERROR_CHECK_PACKETSIZE - if (buf->state == DONE || buf->state == ONE_MSG_ARGS) { - return (buf->bufptr - buf->buffer); - } else { - OSC_errorMessage = "Packet has unterminated bundles"; - return 0; - } -#else - return (buf->bufptr - buf->buffer); -#endif -} - -#define CheckOverflow(buf, bytesNeeded) { \ - if ((bytesNeeded) > OSC_freeSpaceInBuffer(buf)) { \ - OSC_errorMessage = "buffer overflow"; \ - return 1; \ - } \ -} - -static void PatchMessageSize(OSCbuf *buf) { - int4byte size; - size = buf->bufptr - ((char *) buf->thisMsgSize) - 4; - *(buf->thisMsgSize) = size; -} - -int OSC_openBundle(OSCbuf *buf, OSCTimeTag tt) { - if (buf->state == ONE_MSG_ARGS) { - OSC_errorMessage = "Can't open a bundle in a one-message packet"; - return 3; - } - - if (buf->state == DONE) { - OSC_errorMessage = "This packet is finished; can't open a new bundle"; - return 4; - } - - if (++(buf->bundleDepth) >= MAX_BUNDLE_NESTING) { - OSC_errorMessage = "Bundles nested too deeply; change MAX_BUNDLE_NESTING in OpenSoundControl.h"; - return 2; - } - - if (buf->state == GET_ARGS) { - PatchMessageSize(buf); - } - - if (buf->state == EMPTY) { - /* Need 16 bytes for "#bundle" and time tag */ - CheckOverflow(buf, 16); - } else { - /* This bundle is inside another bundle, so we need to leave - a blank size count for the size of this current bundle. */ - CheckOverflow(buf, 20); - *((int4byte *)buf->bufptr) = 0xaaaaaaaa; - buf->prevCounts[buf->bundleDepth] = (int4byte *)buf->bufptr; - - buf->bufptr += 4; - } - - buf->bufptr += OSC_padString(buf->bufptr, "#bundle"); - *((OSCTimeTag *) buf->bufptr) = tt; - buf->bufptr += sizeof(OSCTimeTag); - - buf->state = NEED_COUNT; - return 0; -} - - -int OSC_closeBundle(OSCbuf *buf) { - if (buf->bundleDepth == 0) { - /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ - OSC_errorMessage = "Can't close bundle; no bundle is open!"; - return 5; - } - - if (buf->state == GET_ARGS) { - PatchMessageSize(buf); - } - - if (buf->bundleDepth == 1) { - /* Closing the last bundle: No bundle size to patch */ - buf->state = DONE; - } else { - /* Closing a sub-bundle: patch bundle size */ - int size = buf->bufptr - ((char *) buf->prevCounts[buf->bundleDepth]) - 4; - *(buf->prevCounts[buf->bundleDepth]) = size; - buf->state = NEED_COUNT; - } - - --buf->bundleDepth; - return 0; -} - - -int OSC_closeAllBundles(OSCbuf *buf) { - if (buf->bundleDepth == 0) { - /* This handles EMPTY, ONE_MSG, ARGS, and DONE */ - OSC_errorMessage = "Can't close all bundles; no bundle is open!"; - return 6; - } - - while (buf->bundleDepth > 0) { - OSC_closeBundle(buf); - } - return 0; -} - -int OSC_writeAddress(OSCbuf *buf, char *name) { - int4byte paddedLength; - - if (buf->state == ONE_MSG_ARGS) { - OSC_errorMessage = "This packet is not a bundle, so you can't write another address"; - return 7; - } - - if (buf->state == DONE) { - OSC_errorMessage = "This packet is finished; can't write another address"; - return 8; - } - - paddedLength = OSC_effectiveStringLength(name); - - if (buf->state == EMPTY) { - /* This will be a one-message packet, so no sizes to worry about */ - CheckOverflow(buf, paddedLength); - buf->state = ONE_MSG_ARGS; - } else { - /* GET_ARGS or NEED_COUNT */ - CheckOverflow(buf, 4+paddedLength); - if (buf->state == GET_ARGS) { - /* Close the old message */ - PatchMessageSize(buf); - } - buf->thisMsgSize = (int4byte *)buf->bufptr; - *(buf->thisMsgSize) = 0xbbbbbbbb; - buf->bufptr += 4; - buf->state = GET_ARGS; - } - - /* Now write the name */ - buf->bufptr += OSC_padString(buf->bufptr, name); - return 0; -} - -int OSC_writeFloatArg(OSCbuf *buf, float arg) { - CheckOverflow(buf, 4); - *((float *) buf->bufptr) = arg; - buf->bufptr += 4; - return 0; -} - -int OSC_writeFloatArgs(OSCbuf *buf, int numFloats, float *args) { - int i; - CheckOverflow(buf, 4 * numFloats); - for (i = 0; i < numFloats; i++) { - *((float *) buf->bufptr) = args[i]; - buf->bufptr += 4; - } - return 0; -} - -int OSC_writeIntArg(OSCbuf *buf, int4byte arg) { - CheckOverflow(buf, 4); - *((int4byte *) buf->bufptr) = arg; - buf->bufptr += 4; - return 0; -} - -int OSC_writeStringArg(OSCbuf *buf, char *arg) { - CheckOverflow(buf, OSC_effectiveStringLength(arg)); - buf->bufptr += OSC_padString(buf->bufptr, arg); - return 0; -} - -/* String utilities */ - -static int strlen(char *s) { - int i; - for (i=0; s[i] != '\0'; i++) /* Do nothing */ ; - return i; -} - -#define STRING_ALIGN_PAD 4 -int OSC_effectiveStringLength(char *string) { - int len = strlen(string) + 1; /* We need space for the null char. */ - - /* Round up len to next multiple of STRING_ALIGN_PAD to account for alignment padding */ - if ((len % STRING_ALIGN_PAD) != 0) { - len += STRING_ALIGN_PAD - (len % STRING_ALIGN_PAD); - } - return len; -} - -static int OSC_padString(char *dest, char *str) { - int i; - - for (i = 0; str[i] != '\0'; i++) { - dest[i] = str[i]; - } - - dest[i] = '\0'; - i++; - - for (; (i % STRING_ALIGN_PAD) != 0; i++) { - dest[i] = '\0'; - } - - return i; -} - diff --git a/libOSC/OSC-client.h b/libOSC/OSC-client.h index b1fd833..1be5531 100644 --- a/libOSC/OSC-client.h +++ b/libOSC/OSC-client.h @@ -1,29 +1,24 @@ /* -Copyright (c) 1996,1997. The Regents of the University of California (Regents). -All Rights Reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for educational, research, and not-for-profit purposes, without -fee and without a signed licensing agreement, is hereby granted, provided that -the above copyright notice, this paragraph and the following two paragraphs -appear in all copies, modifications, and distributions. Contact The Office of -Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, -CA 94720-1620, (510) 643-7201, for commercial licensing opportunities. - Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. - - IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, - ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF - REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING - DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". - REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, - ENHANCEMENTS, OR MODIFICATIONS. +University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03 +The Regents of the University of California (Regents). + +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. + +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ /* diff --git a/libOSC/OSC-timetag.c b/libOSC/OSC-timetag.c index 92e3735..666daef 100644 --- a/libOSC/OSC-timetag.c +++ b/libOSC/OSC-timetag.c @@ -1,8 +1,6 @@ /* -Copyright © 1998. The Regents of the University of California (Regents). -All Rights Reserved. - -Written by Matt Wright, The Center for New Music and Audio Technologies, +Copyright (c) 1998,99,2000,01,02,03. The Regents of the University of California (Regents). +All Rights Reserved. Written by Matt Wright, Center for New Music and Audio Technologies, University of California, Berkeley. Permission to use, copy, modify, distribute, and distribute modified versions @@ -26,7 +24,6 @@ The OpenSound Control WWW page is http://www.cnmat.berkeley.edu/OpenSoundControl */ - /* OSC_timeTag.c: library for manipulating OSC time tags diff --git a/libOSC/OSC-timetag.h b/libOSC/OSC-timetag.h index 7e6cbe6..1de1c45 100644 --- a/libOSC/OSC-timetag.h +++ b/libOSC/OSC-timetag.h @@ -1,9 +1,7 @@ /* -Copyright © 1998. The Regents of the University of California (Regents). -All Rights Reserved. - Written by Matt Wright, The Center for New Music and Audio Technologies, -University of California, Berkeley. +University of California, Berkeley. Copyright (c) 1998,99,2000,01,02,03,04 +The Regents of the University of California (Regents). Permission to use, copy, modify, distribute, and distribute modified versions of this software and its documentation without fee and without a signed @@ -26,7 +24,6 @@ The OpenSound Control WWW page is http://www.cnmat.berkeley.edu/OpenSoundControl */ - /* OSC_timeTag.h: library for manipulating OSC time tags Matt Wright, 5/29/97 @@ -1,9 +1,10 @@ /*
-
- pd
+ OpenSoundControl for PD
-------------
+ -- init jdl at xdv dot org
-- tweaks for Win32 www.zeggz.com/raf 13-April-2002
-- smoothed out build, clean up for Darwin <hans@at.or.at> 2004.04.04
+ -- shoutz: miller and the others
*/
#if HAVE_CONFIG_H
diff --git a/src/OSCroute.c b/src/OSCroute.c index f211626..c0a31a0 100644 --- a/src/OSCroute.c +++ b/src/OSCroute.c @@ -1,35 +1,30 @@ /*
-Copyright (c) 1999, 2000, 20010 The Regents of the University of
-California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
-Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
-
-The OpenSound Control WWW page is
- http://www.cnmat.berkeley.edu/OpenSoundControl
-
- OSC-route.c
+Written by Adrian Freed, The Center for New Music and Audio Technologies,
+University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04
+The Regents of the University of California (Regents).
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
+The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
+*/
+
+ /* OSC-route.c
Max object for OSC-style dispatching
To-do:
diff --git a/src/dumpOSC.c b/src/dumpOSC.c index 7a0fcba..bedc5e1 100644 --- a/src/dumpOSC.c +++ b/src/dumpOSC.c @@ -1,32 +1,31 @@ /*
-Copyright (c) 1992,1993,1994,1995,1996,1997,2000.
-The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
-Written by Matt Wright and Adrian Freed, The Center for New Music and Audio
-Technologies, University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
+Written by Matt Wright and Adrian Freed, The Center for New Music and
+Audio Technologies, University of California, Berkeley. Copyright (c)
+1992,93,94,95,96,97,98,99,2000,01,02,03,04 The Regents of the University of
+California (Regents).
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
+The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
*/
+
/*
dumpOSC.c
@@ -57,9 +56,13 @@ Technologies, University of California, Berkeley. Clean up to separate OSC parsing code from socket/select stuff
- pd
+ pd: branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/dumpOSC/dumpOSC.c
-------------
- -- tweaks for Win32 www.zeggz.com/raf 13-April-2002
+ -- 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.
*/
@@ -70,7 +73,6 @@ Technologies, University of California, Berkeley. #include "m_pd.h"
//#include "m_imp.h"
#include "s_stuff.h"
-//#include "x_osc.h"
/* declarations */
@@ -207,6 +209,7 @@ static void dumpOSC_read(t_dumpOSC *x, int sockfd) { //struct sockaddr_in x->x_server;
//while( (n = recvfrom(sockfd, mbuf, MAXMESG, 0, &cl_addr, &clilen)) >0)
// while((
+
#ifdef WIN32
if ((n = recvfrom(sockfd, mbuf, MAXMESG, 0, (SOCKADDR*)&x->x_server, &clilen)) >0)
#else
diff --git a/src/htmsocket.c b/src/htmsocket.c index b9ba16c..3bcf3b9 100644 --- a/src/htmsocket.c +++ b/src/htmsocket.c @@ -1,30 +1,27 @@ /*
-Copyright (c) 1992,1996,1998.
-The Regents of the University of California (Regents).
-All Rights Reserved.
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
-
Written by Adrian Freed, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
+University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04
+The Regents of the University of California (Regents).
+
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
+
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
+The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
*/
/* htmsocket.c
@@ -34,6 +31,10 @@ University of California, Berkeley. Modified 6/6/96 by Matt Wright to understand symbolic host names
in addition to X.X.X.X addresses.
+
+ pd: branched jdl
+ -- win additions raf 2002
+ -- enabled broadcast jdl 2003
*/
#if HAVE_CONFIG_H
@@ -83,15 +84,6 @@ University of California, Berkeley. #include <stdlib.h>
#endif
-
-
-
-
-
-
-
-
-
#define UNIXDG_PATH "/tmp/htm"
#define UNIXDG_TMP "/tmp/htm.XXXXXX"
#include "htmsocket.h"
@@ -233,7 +225,7 @@ void *OpenHTMSocket(char *host, int portnumber) cl_addr.sin_addr.s_addr = htonl(INADDR_ANY);
cl_addr.sin_port = htons(0);
- // enable broadcast
+ // enable broadcast: jdl ~2003
if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) {
perror("setsockopt");
}
@@ -254,7 +246,7 @@ void *OpenHTMSocket(char *host, int portnumber) cl_addr.sin_addr.s_addr = htonl(INADDR_ANY);
cl_addr.sin_port = htons(0);
- // enable broadcast
+ // enable broadcast: jdl ~2003
if(setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &oval, sizeof(int)) == -1) {
perror("setsockopt");
}
diff --git a/src/htmsocket.h b/src/htmsocket.h index b035b57..07bea93 100644 --- a/src/htmsocket.h +++ b/src/htmsocket.h @@ -1,31 +1,30 @@ /* -Copyright (c) 1992,1996. The Regents of the University of California (Regents). -All Rights Reserved. +Written by Adrian Freed, The Center for New Music and Audio Technologies, +University of California, Berkeley. Copyright (c) 1992,93,94,95,96,97,98,99,2000,01,02,03,04 +The Regents of the University of California (Regents). -Permission to use, copy, modify, and distribute this software and its -documentation for educational, research, and not-for-profit purposes, without -fee and without a signed licensing agreement, is hereby granted, provided that -the above copyright notice, this paragraph and the following two paragraphs -appear in all copies, modifications, and distributions. Contact The Office of -Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, -CA 94720-1620, (510) 643-7201, for commercial licensing opportunities. +Permission to use, copy, modify, distribute, and distribute modified versions +of this software and its documentation without fee and without a signed +licensing agreement, is hereby granted, provided that the above copyright +notice, this paragraph and the following two paragraphs appear in all copies, +modifications, and distributions. -Written by Adrian Freed, The Center for New Music and Audio Technologies, -University of California, Berkeley. - - IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, - ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF - REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING - DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". - REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, - ENHANCEMENTS, OR MODIFICATIONS. +IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, +SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING +OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS +BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED +HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE +MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. + + +The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl */ + /* htmparam.h Adrian Freed diff --git a/src/sendOSC.c b/src/sendOSC.c index f4c1d8e..045c98c 100644 --- a/src/sendOSC.c +++ b/src/sendOSC.c @@ -1,65 +1,57 @@ /*
-Copyright (c) 1996,1997. The Regents of the University of California (Regents).
-All Rights Reserved.
+Written by Matt Wright, The Center for New Music and Audio Technologies,
+University of California, Berkeley. Copyright (c) 1996,97,98,99,2000,01,02,03
+The Regents of the University of California (Regents).
-Permission to use, copy, modify, and distribute this software and its
-documentation for educational, research, and not-for-profit purposes, without
-fee and without a signed licensing agreement, is hereby granted, provided that
-the above copyright notice, this paragraph and the following two paragraphs
-appear in all copies, modifications, and distributions. Contact The Office of
-Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley,
-CA 94720-1620, (510) 643-7201, for commercial licensing opportunities.
+Permission to use, copy, modify, distribute, and distribute modified versions
+of this software and its documentation without fee and without a signed
+licensing agreement, is hereby granted, provided that the above copyright
+notice, this paragraph and the following two paragraphs appear in all copies,
+modifications, and distributions.
-Written by Matt Wright, The Center for New Music and Audio Technologies,
-University of California, Berkeley.
-
- IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
- ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
- REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
- DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
- REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
- ENHANCEMENTS, OR MODIFICATIONS.
+IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+
+The OSC webpage is http://cnmat.cnmat.berkeley.edu/OpenSoundControl
*/
+
+
/* sendOSC.c
Matt Wright, 6/3/97
- based on sendOSC.c, which was based on a version by Adrian Freed
+ based on sendOSC.c, which was based on a version by Adrian Freed
Text-based OpenSoundControl client. User can enter messages via command
line arguments or standard input.
Version 0.1: "play" feature
- Version 0.2: Message type tags.
+ Version 0.2: Message type tags.
-
-
- pd
- -------------
- -- added bundle stuff to send. jdl 20020416
- -- tweaks for Win32 www.zeggz.com/raf 13-April-2002
- -- ost_at_test.at + i22_at_test.at, 2000-2002
- modified to compile as pd externel
-
+ pd version branched from http://www.cnmat.berkeley.edu/OpenSoundControl/src/sendOSC/sendOSC.c
+ -------------
+ -- added bundle stuff to send. jdl 20020416
+ -- tweaks for Win32 www.zeggz.com/raf 13-April-2002
+ -- ost_at_test.at + i22_at_test.at, 2000-2002
+ modified to compile as pd externel
*/
#if HAVE_CONFIG_H
#include <config.h>
#endif
-//#define VERSION "http://cnmat.berkeley.edu/OpenSoundControl/sendOSC-0.1.html"
#define MAX_ARGS 2000
#define SC_BUFFER_SIZE 64000
-/*
-compiling:
- cc -o sendOSC sendOSC.c htmsocket.c OpenSoundControl.c OSC_timeTag.c
-*/
#include "m_pd.h"
#include "OSC-common.h"
@@ -71,19 +63,17 @@ compiling: #include <stdlib.h>
#ifdef WIN32
- #include <winsock2.h>
- #include <io.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <sys/stat.h>
+#include <winsock2.h>
+#include <io.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
#else
- //#include "x_osc.h"
-
- #include <stdio.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netdb.h>
- #include <ctype.h>
+#include <stdio.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <ctype.h>
#endif
///////////////////////
@@ -100,7 +90,7 @@ typedef struct { } typedArg;
void CommandLineMode(int argc, char *argv[], void *htmsocket);
-//void InteractiveMode(void *htmsocket);
+
OSCTimeTag ParseTimeTag(char *s);
void ParseInteractiveLine(OSCbuf *buf, char *mesg);
typedArg ParseToken(char *token);
@@ -260,7 +250,8 @@ void sendOSC_senduntyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv) }
//////////////////////////////////////////////////////////////////////
-// this is the real and only sending routine now, for both typed and undtyped mode.
+// this is the real and only sending routine now, for both typed and
+// undtyped mode.
static void sendOSC_sendtyped(t_sendOSC *x, t_symbol *s, int argc, t_atom *argv)
{
|