CNMAT / CNMAT-Externs

CNMAT Max/MSP externals
Other
94 stars 11 forks source link

OpenSoundControl -> downcast? #125

Open mzed opened 4 years ago

mzed commented 4 years ago

I've twice now run into problems where old school users, and old patches, had troubles using OpenSoundControl to parse newer OSC data from o.dot into max messages. Doubles get output as zeros. (see patch below)

It might be nice if OpenSoundControl had downcast functions built in? Or, at least it could throw a warning in the Max window saying that it didn't know what to do with the data it got.


----------begin_max5_patcher----------
603.3oc0V0ziaBCD8LQJ+GP9LkhMekzqqTutUZ2aUUQNvrorErQFytoZU+uW
+ArIJMrghXiZODhX7L9Mu2LdLurbgCZKeOzfb+j6WccbdQYwwXSawo2fCpht
Oqj1XbDUAMMzc.xqaQIrWZV3i471skfaf+qqUVvfLdKy3.o2Zs.Z.ljJK3rM
m2EVaEuUVBRCl3WijJy9dAa2FAjIsoMIMzO1yMbcfefmaLV+LLwOv8a8AY2H
4OqAaDHzg0JxMoNe6iefDfNB8BVO3Diwesbg9e0edymRg8IwWPqFuPDtFaEh
HiPDLYg.udtEhssRImgl.mRr0SawkD0+7M3zVJa2Q7plJnUfDDa.FUo4ZuBN
GoSOOowSlzL3Y0F+mE+aqA1cp5b9MblTvKGPVBGgrDZDDL17Fg710ZO6uau6
l6Kpf6o6Fn5mbsDBteN+YVFsQNoNiDCoiMRPx5Qn.etsr7Kzre.xAXd7+L88
jHaANc06deez+Q88DaC+6Re+rqCOTxU6z.rjbYVhiiOLHeDj7jFfG3hJpYGS
9a6IBudS.pUmGc6tNbJmSrREIvbNYU5bLEXbj2Fq4R6S+9ISdpW3DIog2Jx5
SitVNW7gjHGZjELyWEcjS5OKQ60vh+nwSOZ+x.pu9eNAL3h.lZ8ZN.LdT.lL
e.NJ7NIq3hbPXN7csxfnAR.7Lj.QiRBhlMIObT3cV35NzRqqeBDMcQXQRMv5
QtQSV4YeufYe2N+AIfmJ5CIxZhJTyijpgQsBSBh1mzcKBphqTXVaQuHq4pFZ
yLQlZJbiZxmMH8rykKTN7a.DKfPB
-----------end_max5_patcher-----------
equilet commented 4 years ago

We usually use [o.downcast] as well for this particular use case.
Sorry, that's the best we have at the moment.

equilet commented 4 years ago

I'm leaving myself a note to include this in the forthcoming odot tutorial. ;)

mzed commented 4 years ago

I do tell people to use o.downcast, but that solution isn't obvious -- especially to users who haven't downloaded o.dot. It would be helpful if there was some pointer to a solution that was contained in the CNMAT-externs package.

equilet commented 4 years ago

would something in the opensoundcontrol help file suffice ?

mzed commented 4 years ago

There is a link to o.dot in the OpenSoundControl help. Atau asked me if that meant that OpenSoundControl is deprecated. It seems like it sort of is? (At least, WRT o.dot compatibility?)

I was looking at the source, and the decision to output zeros is happening on lines 963-975. There's actually a comment there suggesting the behavior could be different. I would suggest that silently setting longs and doubles to zero is a bad user interaction. A one line error in the Max window (Received double, setting to zero.) would be better.

What is the maintenance status of these legacy objects?

equilet commented 4 years ago

I can take a look at it - more soon...

equilet commented 4 years ago

for now I post a msg about the dirty deed (https://github.com/CNMAT/CNMAT-Externs/commit/f289b213a4054687ed33531dc5d79eca650dde13) but will also look into a proper downcast function internal to the object.

mzed commented 4 years ago

Actually, case 'h' is a long int (that also gets converted to 0.) case 'd', a couple of lines below, is the double. It would probably be good to make these messages set a flag so they only output once. Otherwise they could flood the Max window.

I can do a pull request later this week.