Hallo,
it occured to me, that sending negative floats over OSC doesn't work here. I'm using OSC ver: 0.2.
As soon as I send something below zero, this comes out:
4.29497e+09
which is very large and the same for all negative numbers. Aren't negative number supposed to be sent over OSC? Or is this a bug in Pd-OSC?
Frank Barknecht _ ______footils.org__
I posted this a while back, I fixed it by turning typetags off.
Problem is I can't send file paths with typetags off so I switch it on and off depending on the message I send (yuck!)
Martin Peach posted a patch/fix I think, check the archives.
Does the maintainer for OSCx read this list??
B. ----- Original Message ----- From: "Frank Barknecht" fbar@footils.org To: pd-list@iem.at Sent: Thursday, December 18, 2003 5:13 PM Subject: [PD] Sending negative numbers over OSC
Hallo,
it occured to me, that sending negative floats over OSC doesn't work here. I'm using OSC ver: 0.2.
As soon as I send something below zero, this comes out:
4.29497e+09
which is very large and the same for all negative numbers. Aren't negative number supposed to be sent over OSC? Or is this a bug in Pd-OSC?
ciao
Frank Barknecht _ ______footils.org__
PD-list mailing list PD-list@iem.at http://iem.at/cgi-bin/mailman/listinfo/pd-list
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
I posted this a while back, I fixed it by turning typetags off.
I could swear that I already tried this, but it seems not.
Problem is I can't send file paths with typetags off so I switch it on and off depending on the message I send (yuck!)
Martin Peach posted a patch/fix I think, check the archives.
Does the maintainer for OSCx read this list??
Yes, I guess, but if I find the patch, I'll try to put it into the CVS, if noone minds (and if I manage to do that...)
Frank Barknecht _ ______footils.org__
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
I posted this a while back, I fixed it by turning typetags off.
Problem is I can't send file paths with typetags off so I switch it on and off depending on the message I send (yuck!)
Martin Peach posted a patch/fix I think, check the archives.
Thanks, I've found it, Martin wrote: ### 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... ###
I'll try this tomorrow and after that will commit it to CVS.
Frank Barknecht _ ______footils.org__
Notice that this fix was for the problem with negative ints. The floats would be repaired like this: around line 750: ### case f: { int i = ntohl(*((int *)p)); to case f: { int i = (signed)ntohl(*((int *)p)); ### Now negative ints and floats seem to work, for me at least... Martin
Frank Barknecht wrote:
Hallo, B. Bogart hat gesagt: // B. Bogart wrote:
I posted this a while back, I fixed it by turning typetags off.
Problem is I can't send file paths with typetags off so I switch it on and off depending on the message I send (yuck!)
Martin Peach posted a patch/fix I think, check the archives.
Thanks, I've found it, Martin wrote: ### 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... ###
I'll try this tomorrow and after that will commit it to CVS.
ciao
Hallo, Martin Peach hat gesagt: // Martin Peach wrote:
Notice that this fix was for the problem with negative ints. The floats would be repaired like this: around line 750: ### case f: { int i = ntohl(*((int *)p)); to case f: { int i = (signed)ntohl(*((int *)p)); ### Now negative ints and floats seem to work, for me at least...
Floats seemed to work okay already, I thought. Didn't they?
I've put your first patch into the CVS now.
Frank Barknecht _ ______footils.org__
In your original post you said "it occured to me, that sending negative floats over OSC doesn't work here " ... I admit I never tried it myself before 'fixing' it, but it still works...
Perhaps in the longer term it would be better to send XML format such as <float>-1.2345</float> so that the vagaries of stuffing machine-dependent representations of floats into machine-dependent representations of integers can be completely avoided, and other formats (like imaginary numbers and expressions) could be included as well. That would require a complete rewrite of the OSC standard though....
Martin
Frank Barknecht wrote:
Hallo, Martin Peach hat gesagt: // Martin Peach wrote:
Notice that this fix was for the problem with negative ints. The floats would be repaired like this: around line 750: ### case f: { int i = ntohl(*((int *)p)); to case f: { int i = (signed)ntohl(*((int *)p)); ### Now negative ints and floats seem to work, for me at least...
Floats seemed to work okay already, I thought. Didn't they?
I've put your first patch into the CVS now.
ciao
Hallo, Martin Peach hat gesagt: // Martin Peach wrote:
In your original post you said "it occured to me, that sending negative floats over OSC doesn't work here "
Yes, I wrote this, but actually after that found out, that -1.01 works, but -1.00 didn't.
... I admit I never tried it myself before 'fixing' it, but it still works...
I could of course include it in the CVS, as well. Just speak up, if I should. I didn't really try to understand the inner worlings of OSC yet, and I'm not *that* eager to actually maintain it ;)
Frank Barknecht _ ______footils.org__