[PD] strings and negative numbers ia OSC

Martin Peach martinrp at vax2.concordia.ca
Thu Feb 19 20:01:19 CET 2004


enrike wrote:
...

> I have also problems with negative numbers. If I pass -1 for example PD 
> gets some ridiculous number like 4.29497e+009. i am not sure if this is 
> the representation of a negative number and then i need to translate it 
> or if this is an error. I am not sure if the problem is from PD, Python 
> or director.

I have already pointed this one out:

In OSCx/OSC/dumpOSC.c line 743, in the function
dumpOSC_PrintTypeTaggedArgs():

change
  SETFLOAT(mya+myargc,ntohl(*((int *) p)));
to
  SETFLOAT(mya+myargc,(signed)ntohl(*((int *) p)));

...since ntohl returns an unsigned integer, you get 0xFFFFFFFF for -1,
which equals 4294967295 decimal...

Martin





More information about the Pd-list mailing list