jamoma / JamomaMax

Implementation of Jamoma for Cycling'74 Max:
http://www.jamoma.org
41 stars 9 forks source link

array of int passing thru j.return/j.parameter/j.message @type generic are ill-formated #937

Closed matcham closed 8 years ago

matcham commented 9 years ago

when I send an array of int thru j.return (to j.send) , the array seems ok, ... but is not ! (standard Max objects that are supposed to receive this array do not like it ...)

in this example, I try to send midi notes (simple array of 2 ints). the message arrives, looks correct (I can print it or display it with a message box) , but noteout or kslider are not able to use it.

note : nslider DO accepts these messages !

so looks like some max objects might be more picky about it than others.

same problem with j.parameter / j.message


----------begin_max5_patcher----------
1259.3oc4ZsziihCD9b5eEdy4LQT9APVoQZOrm24xdazpQDvaG2g.QfS+Pil
+6K9AcHYCzNABIZlCcnsCTT0WU0WU1Ne+gISWl+JubJ52QeEMYx2eXxD8TpI
lXGOY5lnWiSiJ021z37Ma3YxoyLemj+pTO+xcRjPhdIuXcI5EgbEJqLUjvKP
+V88VJeKkqu45Y1VvKqDVjTjm8sBdrznILBct2LDE6otT+A5erOU1tMhrTtT
qPPsnhjwqDYOdfXHMDCDnufaJIQhVcxW9zmnro6Ee9NYs78TS9iGdP8wLGwH
qkWKPizjuskazqoBE9Yt7tp3L3PAl1pBb.bvsCNTlu5QI3P0k.sLgEgs.NzS
CN6keQzFtjW7MdVzRic3Y+tM4I5wvE.jsEr8uE4aJeayx7TzmQY4mc.FDBJ6
kEtnWAXfOtgX.uEcEfQBFv.L9KUhrCXo0PutB3b0rMAKVqNPmigwsXzgm1nu
jfg0CRV0xzn30q4uEmmlWXdxCRjp7iMLkVheBz9cerNJhPzYRLRima0wuAlG
rvGlcx+CtfzWiOvpAUhQqHzFB5kUBI+Ps.rV29ONoc1z62zUt31vAzRr9Syq
.Ct3YNZiHQ7orbYUcrVi5mY+67oaMtZFKrWLE1TFiT.f1UNC06z.MY.IPiRR
pTPTDZaU1.pLO8YdIRthi1VjW461Le97o8lm.HKLUpBzlK.cROxt5ziZaUfD
WD4XaUi8nlTOZupFGvZfTzvNoT89ojR0BjTH3FyoxLkwGGNU3WRN05jFfL.j
pTpuCjpD7vQp1B5ofqJI6HuIoiVyoyYUnisIiN6uBGNbrlsUqvZWnnrDjkv.
8meA8We4uQoh0bUYixpHFdYYzi7xFUNREY737cYxlgz8nbBVCHVbwtbNBoEf
Y.611ZZ++1sS2UtZHKlXKThGfRIFgv75L3gLbURpjvxNJjnHJVFk83E.J.0v
r50uMCv1Lxh.GvE7EvJOfwU9dUrYdCYfENjYHb86UnE3qedbnCfHDLfAWszO
WgHS1+1TI3FFEoydu.10mUgFfBFTmOXLPXAzOmO0P6Rcv2S+orEUBXV9Vn+M
qEULcQCuP+6QsoSiba5E8dxAaZov6VuBDXvctX1c0BM50JwOOvDHZbIry1nA
7cUmPm2BfbokF.FmVZtm1PA0hnX3abtr87UFkcS.eiNklguSFWw3pVZXN1Op
+UuczAe2SNOZf5VC5dePt9aChBFj6JxZfBn+PY4nG4Y7BQbmaOvoApACj.+.
UDCX1KZBqE1xVxitK16.maUDybewZNbLc5mS6zN52Kf9cql+PXnLeWQbsAYC
8P6e6I7RoH6c5rut+flabSqDII7rC3oDIayqJeX0gPyVkYNgepO68Q6eOhRE
WWR6UzbU+Umk4GZ.pSIqSCX3zG04D8w5S3noOt3ewz6J0Qsd96Iz49xYUUxD
Aih1PbJTFFMzg3B7bjReM0Gvof4wK3g3Rv7Hla4D7fGsvYsoCeD9fOuRcXec
ytK7zMvPCqGbEpzAfq34HE9GNDkVNFOIldGLapW39AWC.M3JX.P.a7L.mxvn
iVFla5C4RZlDXleFerv2GcE.ziXGaw.tTJcSu5Qa29LunzJSspTs3jmLa1Pv
L8PQlYnVhSK3OKpuee8LQEwpsoHtZEclkg7ZnYkz5cLnHamvtNgp27Od3+7o
4bXC
-----------end_max5_patcher-----------
theod commented 9 years ago

the trouble is certainly into the JamomaModularForMax.cpp file inside the jamoma_callback_return_value_typed function and jamoma_ttvalue_to_typed_Atom. I'm not able to look into it precisely for now but maybe those information can help someone else to dig into it ?

matcham commented 9 years ago

here s a simpler example showing the problem :

looks like arrays are prepended by some kind of hidden word "list" , and and some Max object do not like it...


----------begin_max5_patcher----------
712.3oc0W00TiBCE8Y5uhL4EevtNjTn.9z9CX+GrtiS.tSMZIvjDbqii+2WH
ApUseDqE15KvvkPtm64dRNgmm3gSKWAJL5ZzuQddOOwyyDpMfW2yd3B1prkL
kYX3BPoXK.7T66zvJsINghHzn9vURPABMSyKE2JgLsMEAAIW4OEQm62dq+B5
OcekntnrVuDzlTQ5hZCoepBrSBFu9CpX5r63hE6LEglqT5FIgmavaY58+fD2
iWk9okloGieEKbQOTnswdYxj1KScjnZlfTPd.BIzetAfIybfPn6jPlhvoLwh
8RLuMUGfXRVialjU.ZPdKHXoVNx2MRibLjF72l7+Aw0kNRieMcEWnchAsYIf
rOFj5OjRqsyRUrrGPbDGeJWNEaEJ1Rm3ueYSz.VzYkEEMs9OT0563JTo.PMC
nZIiKT2Ht3xqQ4kfRbgFUKxAoRyD4navK4J8MqwzRt.xJqE5MWc8VVye2TCc
tYkDII9pvlaQFpYVzFTSZcZ2RFxVHq.7vsN5KsKMIH11ymMX6RS51k1JqNvl
QzATU4FQcRJ4OQES9e6KQrtDT6lbCpuTGiPmkbXhI96ksTOK5GOj1R8Dn819
skRFMg0oThDk3rBI5LUgbh50QIN2pC+V1psG2Hjb3Ncv4Umth8.x+T6YXa2I
DGN6Ec7Ou48Wsl5QEO8qliVg9YakgV.BPxyNB8gKazQB6VDP2qG5Qb5Jy7XN
U369kXCXZi+VRRUVKy5ge+AfQuBmbPo4BiqvFCp8WC1XP2wyyAwlh1btpUGa
pE+s1tNo3o8ufQjQAOuqz2AdRFO9wE3DcdAG530sbANjQCNtvNimzIwAzDOZ
nIzAzLd5XWDNgiFZBbYO4yJtgbjnw5ewppdDjptoz.jF676KksOFM07HWXez
LiXI7Hue7yMQXxFyWciyasz5ctJdN19ok4fTTy67Nax7KS9GTE5CqB
-----------end_max5_patcher-----------
bltzr commented 9 years ago

sounds like pd… ;-)

Le 8 oct. 2015 à 17:15, Mathieu CHamagne notifications@github.com a écrit :

here s a simpler example showing the problem :

looks like arrays are prepended by some kind of hidden word "list" , and and some Max object do not like it...

----------begin_max5_patcher---------- 712.3oc0W00TiBCE8Y5uhL4EevtNjTn.9z9CX+GrtiS.tSMZIvjDbqii+2WH ApUseDqE15KvvkPtm64dRNgmm3gSKWAJL5ZzuQddOOwyyDpMfW2yd3B1prkL kYX3BPoXK.7T66zvJsINghHzn9vURPABMSyKE2JgLsMEAAIW4OEQm62dq+B5 OcekntnrVuDzlTQ5hZCoepBrSBFu9CpX5r63hE6LEglqT5FIgmavaY58+fD2 iWk9okloGieEKbQOTnswdYxj1KScjnZlfTPd.BIzetAfIybfPn6jPlhvoLwh 8RLuMUGfXRVialjU.ZPdKHXoVNx2MRibLjF72l7+Aw0kNRieMcEWnchAsYIf rOFj5OjRqsyRUrrGPbDGeJWNEaEJ1Rm3ueYSz.VzYkEEMs9OT0563JTo.PMC nZIiKT2Ht3xqQ4kfRbgFUKxAoRyD4navK4J8MqwzRt.xJqE5MWc8VVye2TCc tYkDII9pvlaQFpYVzFTSZcZ2RFxVHq.7vsN5KsKMIH11ymMX6RS51k1JqNvl QzATU4FQcRJ4OQES9e6KQrtDT6lbCpuTGiPmkbXhI96ksTOK5GOj1R8Dn819 skRFMg0oThDk3rBI5LUgbh50QIN2pC+V1psG2Hjb3Ncv4Umth8.x+T6YXa2I DGN6Ec7Ou48Wsl5QEO8qliVg9YakgV.BPxyNB8gKazQB6VDP2qG5Qb5Jy7XN U369kXCXZi+VRRUVKy5ge+AfQuBmbPo4BiqvFCp8WC1XP2wyyAwlh1btpUGa pE+s1tNo3o8ufQjQAOuqz2AdRFO9wE3DcdAG530sbANjQCNtvNimzIwAzDOZ nIzAzLd5XWDNgiFZBbYO4yJtgbjnw5ewppdDjptoz.jF676KksOFM07HWXez LiXI7Hue7yMQXxFyWciyasz5ctJdN19ok4fTTy67Nax7KS9GTE5CqB -----------end_max5_patcher----------- — Reply to this email directly or view it on GitHub https://github.com/jamoma/JamomaMax/issues/937#issuecomment-146575864.

theod commented 8 years ago

yes there is a "list" word added before the array. but as it is the Max SDK who provided such feature I'm wondering if the bug is on Jamoma side or on Max side ?

I mean if the "list" word is recognized by most of the basic objects (like message object) I would expect other more advance objects follow the same policy isn't it ?

in Jamoma all externals have a list method to handle quickly arrays which avoid to test the first element in case there is a symbol (which could be the name of a method). so if I remove the "list" word we loose this shortcut and will consume more cpu.

I add @tap and @lossius to this thread to get there point of view.

tap commented 8 years ago

In Max there has always been a distinction between list messages and other types of messages. A legal list in Max always begins with an int or float -- other kinds of "lists" are in fact not lists but just messages with additional arguments.

This distinction was confusing to me initially back in circa 1998/1999. You can see that there is a distinction between handling "list" and handling "anything" here:

https://github.com/tap/TapTools/blob/38d513e828b08f2222ea705e417159ecdae281b4/source/tap.typecheck%7E/tap.typecheck%7E.cpp#L53

theod commented 8 years ago

so the discussion above tends to conclude that is not a jamoma trouble so I would close it. what is your opinion @matcham ?

matcham commented 8 years ago

...no, I don't think we should close it ! I've never seen this trouble anywhere else, so I really think there is something wrong in the way lists are passing thru j.parameter maybe it just doesn't need to prepend 'list' at all ? ...

anyway, the way it works actually is really confusing ...


----------begin_max5_patcher----------
544.3oc2VsraaCCD7r7WAAujCw0PjV1xJm5GP+CpKBnjVXSCIRCRpTaDj+8x
GVNNM1ArJIFs8BA3nUqlc1QK4iiRvkxcfFitC8cTRxiiRR7PNfjC6SvsrcUM
LsOLbKn0rU.db3YFXmwiSPzdLYmoALl8agPhwXzON7nsLS0ZtX08JnxDdJYd
9jzwnYotUZwjY1U5jziuh1ruwmHbe9409sxxMegj1CJ5Z4B6m0yR5yfAx3QI
NvmFMxsLNxxsR11BByqJWyZtFIE.xFv1FFWnWJt416P0RPKtwf5D0fRaXhZz
RbCWaVdj9MbATI6DlSY5YDFJMyIIjoScZBI2KPSyiVZx5AK6JKCwQNmXQNqX
kN.w5i2aP7EMIibhEIdyA8S1bXyPIntboMFgKYhUwX+I4YCoDWfOlYEqELf5
dPvNzsSiuaSGR0C+zRgW0ru8h5A2Y4iPJBc6vZ7RQw+.M6rz2QuN++odcV56
nUO6ytUe9pcyjiJOpc+2rC0Qe0UxnUf.T7p2zaDiyuv6Knoz+v4b3g078Y2e
bzucC.OCc3uTizxNUUeM0e5K5YRVCZCWvLbo3jfl8hXVyqqAwoN1Zt1Yhqu7
gNenzgb0nyrHXS9UiMEQvlEWuVUDro3uJ13tLAhL.5D9Kisc6C1KDdHmdlXm
4rQpbayG62xEgs9LhUvC793m6QXJ6bCicnQmJLKX2h43vqJs21TzwOLvy9ke
Zzu.cGEsuC
-----------end_max5_patcher-----------
theod commented 8 years ago

ok so if the returned values start by a numeric value don't add 'list'

tap commented 8 years ago

Are you using outlet_list() or outlet_anything() ? Maybe if you point me to the spot in the code I can offer a suggestion?

best, Tim

On Fri, Nov 20, 2015 at 11:24 AM, theod notifications@github.com wrote:

ok so if the returned values start by a numeric value don't add 'list'

— Reply to this email directly or view it on GitHub https://github.com/jamoma/JamomaMax/issues/937#issuecomment-158465796.

theod commented 8 years ago

as you can see here (https://github.com/jamoma/JamomaMax/blob/master/source/j.parameter/j.parameter.cpp), in data_return_value I use outlet_anything or outlet_atom.

actually the 'list' word is added before (https://github.com/jamoma/JamomaMax/blob/master/library/source/JamomaModularForMax.cpp) during the conversion of TTValue to atom made into jamoma_ttvalue_to_typed_Atom called from jamoma_callback_return_value_typed.

and precisely I think I should add a case when the size is more than one and the first atom is a numerical value where I don't add 'list' before.

I would like to take care of this a bit latter as this have to be done carefully by launching integration tests.

theod commented 8 years ago

sorry I've forgot to run the integration test so I have to revert the change as it was on master branch.

theod commented 8 years ago

Thanks to the integration tests I've made a fix that's not breaking anything !