I guess it's because all numbers in Pd are floats, but usually integer floats are meant to be integers. But obviously it's impossible for the code to know what the user wants, so you can also force the type by using the [sendtyped ...( message. Probably sending all numbers as floats will annoy an approximately equal number of people.

Martin


On 2012-09-07 07:11, Jamie Bullock wrote:

Hi list,

It looks like the mrpeach [packOSC] external converts Pd floats to OSC integers 
if the float value is equal to the float value cast to an int. From the source 
code:

    /* It might be an int, a float, or a string */
    switch (a->a_type)
    {
        case A_FLOAT:
            f = atom_getfloat(a);
            i = atom_getint(a);
            if (f == (t_float)i)
            { /* assume that if the int and float are the same, it's an int */
                returnVal.type = INT_osc;


Implicitly converting floats to integers based on an arbitrary rule seems a bad 
idea to me. Why bother making the conversion? Why not send floats as floats?

It's certainly going to cause problems for some clients. For example, if the 
client is expecting floats on a given OSC address, it may get:

0.5 -> float
1.0 -> int ???
1.5 -> float

Which may result in dropped values or other anomalies.

I am happy to send a code patch if people agree that this is a bug or at least 
bad design...

best,

Jamie
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list




_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to