oscP5 library, oscEvent_checkTypetag

Hello,

i am working on program about sending/receiving messages with oscP5 library…My problem is that in the begging i have declare my values as double but into the oscEvent(OscMessage m) i dont know how can i check if the packages containing double values…
I know that the function for this job is if (m.checkTypetag(“fff”)) but for float values.
Which one that i must put in the parenthesis represent double values?

Thank you

1 Like

Not sure if oscP5 supports double. If oscP5 follows the same schema that Processing, it is very likely it does not support double types. If you really need to work with doubles, then one thing you could do is to convert the double into bytes and then send your info as a oscP5 blob. A blob is available if you check the lib’s docs. Unfortunately the lib does not provide many examples of this kind. You can try browsing previous posts or try attempting this yourself. If you run into any problem, please provide your code.

A blob example and docs:

http://www.sojamo.com/libraries/oscP5/examples/oscP5message/oscP5message.pde

oscP5 : : OscArgument : : blobValue ( )

If you are ok with floats, then just do a simple casting and use the float type.

Kf

2 Likes

Probably oscP5 does not support double.But i am dealing with longitude, latitude and altitude which can be only double values, as i had provide in my other topic : Geolocation and Osc Message
I am not so expert in the programming so it is a little dififcult for me to understand and make these things that you said… Could you please simplify them or give me another example???

The OSC spec has an optional tag for double support, but it is optional.

Some OSC applications communicate among instances of themselves with additional, nonstandard argument types beyond those specified above. OSC applications are not required to recognize these types; an OSC application should discard any message whose OSC Type Tag String contains any unrecognized OSC Type Tags. An application that does use any additional argument types must encode them with the OSC Type Tags in this table:

tag: d
Type of corresponding argument: 64 bit (“double”) IEEE 754 floating point number

That is the OSC protocol itself – at least, 1.0, I’m not certain about 1.1 – before client implementations such as oscP5. So you could check the oscP5 source to see if it handles ‘d’.

In addition to @kfrajer’s blob suggestion:

If oscP5 doesn’t support double, then you could use int32s like in the standard examples.

For example, one workaround would be to copy the 64 bits of a double into two int32s, send them over OSC, then copy the bits from the two ints back into one double.

2 Likes

Thank you for your advise…I will study about all of that and i hope i wil solve my problem…:grinning::wink::blush:

If you search the oscp5 source for “double”, there are many hits throughout the code for sending and receiving doubles and interpreting double tags. It appears that the oscp5 library for Processing has full double support (untested).

For example:

1 Like

ok you have right…The next thing is that i have to test some differences in the code to see if double values will supported.
I have one more question about oscP5, if there is a way to send/recieve data such as csv files with oscP5 library and its functions. I have made a new Topic about that ang unfortunately i get no response.

Thank you so much for your response and for your help

Hi @netphysicist

There has been some changes in Processing in the latest release, v3.4, of interest:

[ do you like data? ]

  • Added Double and Long versions of the data classes. Not sure if we’ll
    keep these, but we’re trying them out.

  • Also add subset(long) and subset(double) to PApplet

  • Changed the internal Sort class to use int for comparisons for better
    accuracy, especially when working with double and long values.

Unfortunately I do not know how deep these changes are and you are in the front wave experiencing these new features. I was not aware of oscP5 implementing double, so I can see it is good to have other volunteers helping and sharing their experience (You know who you are!)

Related to your question about csv, it is good you open a new post as it is a different topic.

Kf

1 Like