[PD-cvs] externals/OSCx/libOSC OSC-timetag.c,1.1.1.1,1.2 OSC-timetag.h,1.1.1.1,1.2
Hans-Christoph Steiner
eighthave at users.sourceforge.net
Wed Apr 7 06:15:06 CEST 2004
- Previous message: [PD-cvs] externals/OSCx LICENSE,1.1,1.2
- Next message: [PD-cvs] externals/OSCx/src OSC-system-dependent.c,NONE,1.1 Makefile.in,1.5,1.6 OSC-common.h,1.2,1.3 OSC-pattern-match.c,1.3,1.4 OSC-pattern-match.h,1.2,1.3 sendOSC.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/pure-data/externals/OSCx/libOSC
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27559/libOSC
Modified Files:
OSC-timetag.c OSC-timetag.h
Log Message:
added files from OSC-Kit 1.0 in order to get updated free license; added GPL to my modifications
Index: OSC-timetag.h
===================================================================
RCS file: /cvsroot/pure-data/externals/OSCx/libOSC/OSC-timetag.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** OSC-timetag.h 6 Aug 2002 12:13:57 -0000 1.1.1.1
--- OSC-timetag.h 7 Apr 2004 04:15:04 -0000 1.2
***************
*** 1,28 ****
/*
! Copyright (c) 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 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
--- 1,25 ----
/*
! 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.
! 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 OpenSound Control WWW page is
***************
*** 30,33 ****
--- 27,31 ----
*/
+
/*
OSC_timeTag.h: library for manipulating OSC time tags
***************
*** 36,44 ****
Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the
top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom
! 32 bits giving fractional parts of a second. We represent this by a 64-bit
unsigned long if possible, or else a struct.
! NB: On many architectures with 64-bit ints, it's illegal (like maybe a bus error)
! to dereference a pointer to a 64-bit int that's not 64-bit aligned.
*/
--- 34,42 ----
Time tags in OSC have the same format as in NTP: 64 bit fixed point, with the
top 32 bits giving number of seconds sinve midnight 1/1/1900 and the bottom
! 32 bits giving fractional parts of a second. We represent this by an 8-byte
unsigned long if possible, or else a struct.
! NB: On many architectures with 8-byte ints, it's illegal (like maybe a bus error)
! to dereference a pointer to an 8 byte int that's not 8-byte aligned.
*/
***************
*** 49,69 ****
#define HAS8BYTEINT
/* You may have to change this typedef if there's some other
! way to specify 64 bit ints on your system */
! typedef long long int64;
! typedef unsigned long long uint64;
! typedef unsigned long uint32;
#else
/* You may have to redefine this typedef if ints on your system
! aren't 32 bits. */
! typedef unsigned int uint32;
#endif
#ifdef HAS8BYTEINT
! typedef uint64 OSCTimeTag;
#else
typedef struct {
! uint32 seconds;
! uint32 fraction;
} OSCTimeTag;
#endif
--- 47,67 ----
#define HAS8BYTEINT
/* You may have to change this typedef if there's some other
! way to specify 8 byte ints on your system */
! typedef long long int8;
! typedef unsigned long long uint8;
! typedef unsigned long uint4;
#else
/* You may have to redefine this typedef if ints on your system
! aren't 4 bytes. */
! typedef unsigned int uint4;
#endif
#ifdef HAS8BYTEINT
! typedef uint8 OSCTimeTag;
#else
typedef struct {
! uint4 seconds;
! uint4 fraction;
} OSCTimeTag;
#endif
Index: OSC-timetag.c
===================================================================
RCS file: /cvsroot/pure-data/externals/OSCx/libOSC/OSC-timetag.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** OSC-timetag.c 6 Aug 2002 12:13:57 -0000 1.1.1.1
--- OSC-timetag.c 7 Apr 2004 04:15:04 -0000 1.2
***************
*** 1,175 ****
! /*
! Copyright (c) 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 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_timeTag.c: library for manipulating OSC time tags
! Matt Wright, 5/29/97
!
! Version 0.2 (9/11/98): cleaned up so no explicit type names in the .c file.
!
! */
!
! #include "OSC-timetag.h"
!
!
! #ifdef HAS8BYTEINT
! #define TWO_TO_THE_32_FLOAT 4294967296.0f
!
! OSCTimeTag OSCTT_Immediately(void) {
! return (OSCTimeTag) 1;
! }
!
! OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) {
! return (OSCTimeTag) 0xffffffffffffffff;
! }
!
! OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) {
! int64 offset = (int64) (secondsOffset * TWO_TO_THE_32_FLOAT);
!
! /* printf("* OSCTT_PlusSeconds %llx plus %f seconds (i.e., %lld offset) is %llx\n", original,
! secondsOffset, offset, original + offset); */
!
! return original + offset;
! }
!
! int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) {
! #if 0
! printf("***** OSCTT_Compare(%llx, %llx): %d\n", left, right,
! (left<right) ? -1 : ((left == right) ? 0 : 1));
! #endif
! if (left < right) {
! return -1;
! } else if (left == right) {
! return 0;
! } else {
! return 1;
! }
! }
!
! #ifdef __sgi
! #include <sys/time.h>
!
! #define SECONDS_FROM_1900_to_1970 2208988800 /* 17 leap years */
! #define TWO_TO_THE_32_OVER_ONE_MILLION 4295
!
!
! OSCTimeTag OSCTT_CurrentTime(void) {
! uint64 result;
! uint32 usecOffset;
! struct timeval tv;
! struct timezone tz;
!
! BSDgettimeofday(&tv, &tz);
!
! /* First get the seconds right */
! result = (unsigned) SECONDS_FROM_1900_to_1970 +
! (unsigned) tv.tv_sec -
! (unsigned) 60 * tz.tz_minuteswest +
! (unsigned) (tz.tz_dsttime ? 3600 : 0);
!
! #if 0
! /* No timezone, no DST version ... */
! result = (unsigned) SECONDS_FROM_1900_to_1970 +
! (unsigned) tv.tv_sec;
! #endif
!
!
! /* make seconds the high-order 32 bits */
! result = result << 32;
!
! /* Now get the fractional part. */
! usecOffset = (unsigned) tv.tv_usec * (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION;
! /* printf("** %ld microsec is offset %x\n", tv.tv_usec, usecOffset); */
!
! result += usecOffset;
!
! /* printf("* OSCTT_CurrentTime is %llx\n", result); */
! return result;
! }
!
! #else /* __sgi */
!
! /* Instead of asking your operating system what time it is, it might be
! clever to find out the current time at the instant your application
! starts audio processing, and then keep track of the number of samples
! output to know how much time has passed. */
!
! /* Loser version for systems that have no ability to tell the current time: */
! OSCTimeTag OSCTT_CurrentTime(void) {
! return (OSCTimeTag) 1;
! }
!
! #endif /* __sgi */
!
!
! #else /* Not HAS8BYTEINT */
!
! OSCTimeTag OSCTT_CurrentTime(void) {
! OSCTimeTag result;
! result.seconds = 0;
! result.fraction = 1;
! return result;
! }
!
! OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) {
! OSCTimeTag result;
! result.seconds = 0xffffffff;
! result.fraction = 0xffffffff;
! return result;
! }
!
! OSCTimeTag OSCTT_Immediately(void) {
! OSCTimeTag result;
! result.seconds = 0;
! result.fraction = 1;
! return result;
! }
!
! OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) {
! OSCTimeTag result;
! result.seconds = 0;
! result.fraction = 1;
! return result;
! }
!
! int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) {
! /* Untested! */
! int highResult = left.seconds - right.seconds;
!
! if (highResult != 0) return highResult;
!
! return left.fraction - right.fraction;
! }
!
!
! #endif /* HAS8BYTEINT */
!
--- 1,173 ----
! /*
! 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.
!
! 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 OpenSound Control WWW page is
! http://www.cnmat.berkeley.edu/OpenSoundControl
! */
!
!
! /*
!
! OSC_timeTag.c: library for manipulating OSC time tags
! Matt Wright, 5/29/97
!
! Version 0.2 (9/11/98): cleaned up so no explicit type names in the .c file.
!
! */
!
! #include "OSC-timetag.h"
!
!
! #ifdef HAS8BYTEINT
! #define TWO_TO_THE_32_FLOAT 4294967296.0f
!
! OSCTimeTag OSCTT_Immediately(void) {
! return (OSCTimeTag) 1;
! }
!
! OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) {
! return (OSCTimeTag) 0xffffffffffffffff;
! }
!
! OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) {
! int8 offset = (int8) (secondsOffset * TWO_TO_THE_32_FLOAT);
!
! /* printf("* OSCTT_PlusSeconds %llx plus %f seconds (i.e., %lld offset) is %llx\n", original,
! secondsOffset, offset, original + offset); */
!
! return original + offset;
! }
!
! int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) {
! #if 0
! printf("***** OSCTT_Compare(%llx, %llx): %d\n", left, right,
! (left<right) ? -1 : ((left == right) ? 0 : 1));
! #endif
! if (left < right) {
! return -1;
! } else if (left == right) {
! return 0;
! } else {
! return 1;
! }
! }
!
! #ifdef __sgi
! #include <sys/time.h>
!
! #define SECONDS_FROM_1900_to_1970 2208988800 /* 17 leap years */
! #define TWO_TO_THE_32_OVER_ONE_MILLION 4295
!
!
! OSCTimeTag OSCTT_CurrentTime(void) {
! uint8 result;
! uint4 usecOffset;
! struct timeval tv;
! struct timezone tz;
!
! BSDgettimeofday(&tv, &tz);
!
! /* First get the seconds right */
! result = (unsigned) SECONDS_FROM_1900_to_1970 +
! (unsigned) tv.tv_sec -
! (unsigned) 60 * tz.tz_minuteswest +
! (unsigned) (tz.tz_dsttime ? 3600 : 0);
!
! #if 0
! /* No timezone, no DST version ... */
! result = (unsigned) SECONDS_FROM_1900_to_1970 +
! (unsigned) tv.tv_sec;
! #endif
!
!
! /* make seconds the high-order 32 bits */
! result = result << 32;
!
! /* Now get the fractional part. */
! usecOffset = (unsigned) tv.tv_usec * (unsigned) TWO_TO_THE_32_OVER_ONE_MILLION;
! /* printf("** %ld microsec is offset %x\n", tv.tv_usec, usecOffset); */
!
! result += usecOffset;
!
! /* printf("* OSCTT_CurrentTime is %llx\n", result); */
! return result;
! }
!
! #else /* __sgi */
!
! /* Instead of asking your operating system what time it is, it might be
! clever to find out the current time at the instant your application
! starts audio processing, and then keep track of the number of samples
! output to know how much time has passed. */
!
! /* Loser version for systems that have no ability to tell the current time: */
! OSCTimeTag OSCTT_CurrentTime(void) {
! return (OSCTimeTag) 1;
! }
!
! #endif /* __sgi */
!
!
! #else /* Not HAS8BYTEINT */
!
! OSCTimeTag OSCTT_CurrentTime(void) {
! OSCTimeTag result;
! result.seconds = 0;
! result.fraction = 1;
! return result;
! }
!
! OSCTimeTag OSCTT_BiggestPossibleTimeTag(void) {
! OSCTimeTag result;
! result.seconds = 0xffffffff;
! result.fraction = 0xffffffff;
! return result;
! }
!
! OSCTimeTag OSCTT_Immediately(void) {
! OSCTimeTag result;
! result.seconds = 0;
! result.fraction = 1;
! return result;
! }
!
! OSCTimeTag OSCTT_PlusSeconds(OSCTimeTag original, float secondsOffset) {
! OSCTimeTag result;
! result.seconds = 0;
! result.fraction = 1;
! return result;
! }
!
! int OSCTT_Compare(OSCTimeTag left, OSCTimeTag right) {
! /* Untested! */
! int highResult = left.seconds - right.seconds;
!
! if (highResult != 0) return highResult;
!
! return left.fraction - right.fraction;
! }
!
!
! #endif /* HAS8BYTEINT */
!
- Previous message: [PD-cvs] externals/OSCx LICENSE,1.1,1.2
- Next message: [PD-cvs] externals/OSCx/src OSC-system-dependent.c,NONE,1.1 Makefile.in,1.5,1.6 OSC-common.h,1.2,1.3 OSC-pattern-match.c,1.3,1.4 OSC-pattern-match.h,1.2,1.3 sendOSC.c,1.2,1.3
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Pd-cvs
mailing list